gnu.jel.reflect
Interface Member

All Known Implementing Classes:
LocalField

public interface Member
extends java.lang.reflect.Member

Represents a member of a class, which is field or method.


Fields inherited from interface java.lang.reflect.Member
DECLARED, PUBLIC
 
Method Summary
 java.lang.Object eval(java.lang.Object obj, java.lang.Object[] params)
          Evaluates the member.
 int getModifiers()
          Returns modifiers and more.
 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 interface java.lang.reflect.Member
getDeclaringClass, getName
 

Method Detail

getModifiers

public int getModifiers()
Returns modifiers and more.

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 ()
 
Specified by:
getModifiers in interface java.lang.reflect.Member
Returns:
modifiers for the method.

getType

public java.lang.Class getType()
Used to get the type of this 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.

Returns:
the type of this member.

getTypeID

public int getTypeID()
Returns an integer identifier of this member type.

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.

Returns:
the type of this member encoded as an int.

getParameterTypes

public java.lang.Class[] getParameterTypes()
Used to get types and number of parameters needed to evaluate this member.

Is there are no parameters (like for fields) it returns an array of length zero.

Returns:
the array of parameters of this member.

eval

public java.lang.Object eval(java.lang.Object obj,
                             java.lang.Object[] params)
                      throws java.lang.Exception
Evaluates the 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.

Parameters:
obj - this pointer of corresponding object.
params - array of parameters wrapped in reflection objects.
Returns:
the result wrapped in a reflection object.