|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.jel.reflect.LocalField
Represents a field local to the class being compiled.
Field Summary | |
protected int |
modifiers
|
Fields inherited from interface java.lang.reflect.Member |
DECLARED, PUBLIC |
Constructor Summary | |
LocalField(int modifiers,
java.lang.Class type,
java.lang.String name,
java.lang.Object constValue)
Constructs a new local field. |
Method Summary | |
void |
code(ClassFile cf)
Generates the code for loading this field to stack. |
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
eval(java.lang.Object obj,
java.lang.Object[] params)
Evaluates the member. |
java.lang.Class |
getDeclaringClass()
|
int |
getModifiers()
Returns modifiers and more. |
java.lang.String |
getName()
|
java.lang.Class[] |
getParameterTypes()
Used to get types and number of parameters needed to evaluate this member. |
java.lang.Class |
getType()
Used to get the type of this member. |
int |
getTypeID()
Returns an integer identifier of this member type. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int modifiers
Constructor Detail |
public LocalField(int modifiers, java.lang.Class type, java.lang.String name, java.lang.Object constValue)
modifiers
- field modifiers, a sum of one or more of PUBLIC,
PRIVATE,PROTECTED, STATIC,
FINAL,VOLATILE, TRANSIENT
constants defined in java.lang.reflect.Modifiertype
- is a class representing the type of this field.name
- is the name of this field.constValue
- is the value of this field if it is static final,
null otherwise.Method Detail |
public java.lang.Class getDeclaringClass()
getDeclaringClass
in interface java.lang.reflect.Member
public java.lang.String getName()
getName
in interface java.lang.reflect.Member
public int getModifiers()
Member
This method returns modifiers of the method in the less significant half of the returned int, and the type of member in the other part. The members are encoded according to the following scheme.
1 - field 2 - method 3 - constructor ()
getModifiers
in interface Member
gnu.jel.reflect.Member
public java.lang.Class getType()
Member
For fields it is the field type, for methods it is the method return value.
Primitive types are encoded as TYPE fields of corresponding reflection objects.
getType
in interface Member
gnu.jel.reflect.Member
public int getTypeID()
Member
For performance and indexing reasons JEL encodes all Java types by integers. The encoding is defined in gnu.jel.TypesStack class. This method returns an integer encoding of this member's type.
getTypeID
in interface Member
gnu.jel.reflect.Member
public java.lang.Class[] getParameterTypes()
Member
Is there are no parameters (like for fields) it returns an array of length zero.
getParameterTypes
in interface Member
gnu.jel.reflect.Member
public java.lang.Object eval(java.lang.Object obj, java.lang.Object[] params) throws java.lang.Exception
Member
Looks up the value of the field or calls the method.
Not all members can be evaluated, for example non static final local fields can not since they exist only in compiler's memory.
eval
in interface Member
gnu.jel.reflect.Member
obj
- this pointer of corresponding object.params
- array of parameters wrapped in reflection objects.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void code(ClassFile cf)
For field/variable invoke means to get value. No type checks are performed.
code
in interface Member
cf
- classfile to append instructions to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |