anvil.core.reflect
Class Reflection

java.lang.Object
  |
  +--anvil.core.Any
        |
        +--anvil.core.AnyAbstractClass
              |
              +--anvil.core.reflect.Reflection
All Implemented Interfaces:
ClassType, java.lang.Cloneable, java.lang.Comparable, InterfaceType, ParameterTypes, ReflectedJava, Scope, Type

public class Reflection
extends AnyAbstractClass
implements ClassType, InterfaceType, ParameterTypes, ReflectedJava


Field Summary
 
Fields inherited from class anvil.core.Any
_class, ARRAY0, DOUBLE_MINUS_ONE, DOUBLE_ONE, DOUBLE_ZERO, EMPTY_STRING, EMPTY_TUPLE, FALSE, INF, IS_ARRAY, IS_BINARY, IS_BOOLEAN, IS_BUFFER, IS_CLASS, IS_DOUBLE, IS_ENUMERATION, IS_INF, IS_INT, IS_LIST, IS_MAP, IS_NEG_INF, IS_NULL, IS_PATTERN, IS_RANGE, IS_STRING, IS_TUPLE, IS_UNDEFINED, MINUS_ONE, NAN, NEG_INF, NULL, ONE, p_compareTo, p_each, p_equals, p_pipe, p_select, THREE, TRUE, TWO, UNDEFINED, ZERO
 
Fields inherited from interface anvil.script.Type
CLASS, CONSTANT_VARIABLE, CONSTRUCTOR, FUNCTION, FUNCTION_PARAMETER, GLOBAL_NAMESPACE, IMPORT, INTERFACE, INTERFACE_METHOD, LOCAL_VARIABLE, MEMBER_VARIABLE, METHOD, MODULE, NAMESPACE, SCOPE0, STATIC_VARIABLE, SYSTEM_NAMESPACE, TYPE_NAMES
 
Fields inherited from interface anvil.core.reflect.ParameterTypes
ANVIL_CORE_ANY, BEST, BOOLEAN, BOOLEAN_ARRAY, BYTE, BYTE_ARRAY, CHAR, CHAR_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT, FLOAT_ARRAY, GOOD, INT, INT_ARRAY, JAVA_LANG_BOOLEAN, JAVA_LANG_BYTE, JAVA_LANG_CHAR, JAVA_LANG_DOUBLE, JAVA_LANG_FLOAT, JAVA_LANG_INT, JAVA_LANG_LONG, JAVA_LANG_NUMBER, JAVA_LANG_OBJECT, JAVA_LANG_OBJECT_ARRAY, JAVA_LANG_SHORT, JAVA_LANG_STRING, JAVA_LANG_STRING_ARRAY, JAVA_LANG_STRINGBUFFER, JAVA_MATH_BIGDECIMAL, JAVA_MATH_BIGINTEGER, LONG, LONG_ARRAY, MAX_ANYS, MAX_TYPES, MAYBE, NO, POOR, SHORT, SHORT_ARRAY, TYPES
 
Constructor Summary
Reflection()
           
Reflection(java.lang.Class cls)
           
 
Method Summary
 Any arrayGet(java.lang.Object array, int index)
           
 int arrayLength(java.lang.Object array)
           
 void arraySet(java.lang.Object array, int index, Any value)
           
 ClassType classOf()
          Returns the type of this Any.
 Any execute(Context context)
           
 Any execute(Context context, Any param1)
           
 Any execute(Context context, Any[] parameters)
           
 Any execute(Context context, Any param1, Any param2)
           
 Any execute(Context context, Any param1, Any param2, Any param3)
           
 Any execute(Context context, Any param1, Any param2, Any param3, Any param4)
           
 Any getAttribute(Context context, java.lang.String attribute)
           
 ClassRef getBase()
           
 ClassType getBaseClass()
           
 InterfaceRef[] getBases()
           
 ConstructorType getConstructor()
           
 int getConstructorReference(ConstantPool pool)
           
 java.util.Iterator getDeclarations()
           
 java.lang.String getDescriptor()
           
 ClassDispatcher getDispatcher(Context context)
           
 Doc getDocument()
           
 ClassType[] getEnclosingClasses()
           
 InterfaceRef[] getInterfaces()
           
 java.lang.Class getJavaClass()
           
 java.lang.String getName()
           
 Scope getParent()
           
 Scope[] getParents()
           
 java.lang.String getPathinfo()
           
 java.lang.String getQualifiedName()
           
 Any getReference(Context context, Any index)
           
 java.lang.String getSignature()
           
 int getType()
           
 int getTypeRef(ConstantPool pool)
           
 boolean hasMethod(java.lang.String name)
           
 void initialize(java.lang.Class cls)
           
 Any invoke(Context context, int methodIndex)
           
 Any invoke(Context context, int methodIndex, Any param1)
           
 Any invoke(Context context, int methodIndex, Any[] parameters)
           
 Any invoke(Context context, int methodIndex, Any param1, Any param2)
           
 Any invoke(Context context, int methodIndex, Any param1, Any param2, Any param3)
           
 Any invoke(Context context, int methodIndex, Any param1, Any param2, Any param3, Any param4)
           
 Any invoke(Context context, java.lang.Object instance, int methodIndex, Any[] parameters)
           
 Any invoke(Context context, java.lang.Object instance, java.lang.String methodName, Any[] parameters)
           
 Any invoke(Context context, java.lang.String methodName)
           
 Any invoke(Context context, java.lang.String methodName, Any param1)
           
 Any invoke(Context context, java.lang.String methodName, Any[] parameters)
           
 Any invoke(Context context, java.lang.String methodName, Any param1, Any param2)
           
 Any invoke(Context context, java.lang.String methodName, Any param1, Any param2, Any param3)
           
 Any invoke(Context context, java.lang.String methodName, Any param1, Any param2, Any param3, Any param4)
           
 boolean isArray()
          Checks if this any is array.
 boolean isInstanceOf(Type ofType)
          Checks if this any is of given type.
 boolean isPrivate()
           
 Type lookupDeclaration(java.lang.String name)
           
 Type lookupInheritedDeclaration(java.lang.String name)
           
 Any newInstance()
           
 Any setAttribute(Context context, java.lang.String attribute, Any value)
           
 Any setReference(Context context, Any index, Any value)
           
 java.lang.Object toObject()
          Gets the contained value as java.lang.Object.
 java.lang.String toString()
          Converts contained value into String.
 
Methods inherited from class anvil.core.AnyAbstractClass
doSerialize, isMutable, serialize, serializeObject, toBoolean, typeOf, unserialize, unserializeObject
 
Methods inherited from class anvil.core.Any
_clone, _copy, _invoke, _invoke, _invoke, _invoke, _invoke, _invoke, _serialize, _unserialize, _wakeup, add, classNameOf, clone, coerce, compare, compareTo, concat, contains, copy, create, create, create, create, create, create, create, create, create, create, create, create, create, create, decrease, deleteAttribute, deleteReference, divide, equals, getRef, has, increase, isBinary, isBoolean, isBuffer, isDefined, isDouble, isInt, isIterator, isList, isMap, isNull, isPattern, isRange, isRef, isSequence, isString, isTuple, isUndefined, iterator, m_clone, m_compareTo, m_copy, m_each, m_equals, m_hashCode, m_pipe, m_select, m_toBoolean, m_toString, minus, modulo, multiply, not, plus, setRef, setReference, sizeOf, subtract, toAnvil, toAnvil, toAnyBoolean, toAnyDouble, toAnyInt, toAnyString, toArray, toBinary, toBuffer, toByte, toChar, toCode, toDouble, toInt, toList, toLong, toMap, toPattern, toRange, toTuple, type
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Reflection

public Reflection()

Reflection

public Reflection(java.lang.Class cls)
Method Detail

initialize

public void initialize(java.lang.Class cls)

getSignature

public java.lang.String getSignature()

getJavaClass

public java.lang.Class getJavaClass()

classOf

public ClassType classOf()
Description copied from class: Any
Returns the type of this Any.

Specified by:
classOf in class AnyAbstractClass

isInstanceOf

public boolean isInstanceOf(Type ofType)
Description copied from class: Any
Checks if this any is of given type.

Specified by:
isInstanceOf in interface ClassType
Overrides:
isInstanceOf in class Any
Returns:
true if this any if of given type.

toString

public java.lang.String toString()
Description copied from class: Any
Converts contained value into String.

Overrides:
toString in class AnyAbstractClass
Returns:
Value as String.

toObject

public java.lang.Object toObject()
Description copied from class: Any
Gets the contained value as java.lang.Object.

Overrides:
toObject in class Any
Returns:
Value as Object.

getName

public java.lang.String getName()
Specified by:
getName in interface Type

isPrivate

public boolean isPrivate()
Specified by:
isPrivate in interface Type

getQualifiedName

public java.lang.String getQualifiedName()
Specified by:
getQualifiedName in interface ClassType

getType

public int getType()
Specified by:
getType in interface Type

getParent

public Scope getParent()
Specified by:
getParent in interface Type

getParents

public Scope[] getParents()
Specified by:
getParents in interface Type

getEnclosingClasses

public ClassType[] getEnclosingClasses()
Specified by:
getEnclosingClasses in interface ClassType

getPathinfo

public java.lang.String getPathinfo()
Specified by:
getPathinfo in interface ClassType

getDocument

public Doc getDocument()
Specified by:
getDocument in interface Type

getDeclarations

public java.util.Iterator getDeclarations()
Specified by:
getDeclarations in interface Scope

lookupDeclaration

public Type lookupDeclaration(java.lang.String name)
Specified by:
lookupDeclaration in interface Scope

getBase

public ClassRef getBase()
Specified by:
getBase in interface ClassType

getBaseClass

public ClassType getBaseClass()
Specified by:
getBaseClass in interface ClassType

lookupInheritedDeclaration

public Type lookupInheritedDeclaration(java.lang.String name)
Specified by:
lookupInheritedDeclaration in interface ClassType

getInterfaces

public InterfaceRef[] getInterfaces()
Specified by:
getInterfaces in interface ClassType

getBases

public InterfaceRef[] getBases()
Specified by:
getBases in interface InterfaceType

getConstructor

public ConstructorType getConstructor()
Specified by:
getConstructor in interface ClassType

newInstance

public Any newInstance()
Specified by:
newInstance in interface ClassType

hasMethod

public boolean hasMethod(java.lang.String name)

getAttribute

public Any getAttribute(Context context,
                        java.lang.String attribute)
Overrides:
getAttribute in class Any

setAttribute

public Any setAttribute(Context context,
                        java.lang.String attribute,
                        Any value)
Overrides:
setAttribute in class Any

getReference

public Any getReference(Context context,
                        Any index)
Overrides:
getReference in class Any

setReference

public Any setReference(Context context,
                        Any index,
                        Any value)
Overrides:
setReference in class Any

invoke

public Any invoke(Context context,
                  java.lang.Object instance,
                  int methodIndex,
                  Any[] parameters)

invoke

public Any invoke(Context context,
                  java.lang.Object instance,
                  java.lang.String methodName,
                  Any[] parameters)

invoke

public Any invoke(Context context,
                  int methodIndex,
                  Any[] parameters)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  int methodIndex)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  int methodIndex,
                  Any param1)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  int methodIndex,
                  Any param1,
                  Any param2)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  int methodIndex,
                  Any param1,
                  Any param2,
                  Any param3)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  int methodIndex,
                  Any param1,
                  Any param2,
                  Any param3,
                  Any param4)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName,
                  Any[] parameters)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName,
                  Any param1)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName,
                  Any param1,
                  Any param2)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName,
                  Any param1,
                  Any param2,
                  Any param3)
Overrides:
invoke in class Any

invoke

public Any invoke(Context context,
                  java.lang.String methodName,
                  Any param1,
                  Any param2,
                  Any param3,
                  Any param4)
Overrides:
invoke in class Any

getDispatcher

public ClassDispatcher getDispatcher(Context context)
Specified by:
getDispatcher in interface ClassType

execute

public Any execute(Context context,
                   Any[] parameters)
Overrides:
execute in class Any

execute

public Any execute(Context context)
Overrides:
execute in class Any

execute

public Any execute(Context context,
                   Any param1)
Overrides:
execute in class Any

execute

public Any execute(Context context,
                   Any param1,
                   Any param2)
Overrides:
execute in class Any

execute

public Any execute(Context context,
                   Any param1,
                   Any param2,
                   Any param3)
Overrides:
execute in class Any

execute

public Any execute(Context context,
                   Any param1,
                   Any param2,
                   Any param3,
                   Any param4)
Overrides:
execute in class Any

getDescriptor

public java.lang.String getDescriptor()
Specified by:
getDescriptor in interface ClassType

getTypeRef

public int getTypeRef(ConstantPool pool)
Specified by:
getTypeRef in interface Type

getConstructorReference

public int getConstructorReference(ConstantPool pool)
Specified by:
getConstructorReference in interface ClassType

arrayGet

public Any arrayGet(java.lang.Object array,
                    int index)

arraySet

public void arraySet(java.lang.Object array,
                     int index,
                     Any value)

isArray

public boolean isArray()
Description copied from class: Any
Checks if this any is array.

Overrides:
isArray in class Any
Returns:
true if this is array

arrayLength

public int arrayLength(java.lang.Object array)