gnu.jel.reflect
Class Method
java.lang.Object
|
+--gnu.jel.reflect.LocalField
|
+--gnu.jel.reflect.LocalMethod
|
+--gnu.jel.reflect.Method
- All Implemented Interfaces:
- Member, java.lang.reflect.Member
- public class Method
- extends LocalMethod
Represents a method of already compiled class.
Fields inherited from interface java.lang.reflect.Member |
DECLARED, PUBLIC |
Constructor Summary |
Method(java.lang.reflect.Constructor c)
Constructs a new Method object for a constructor. |
Method(java.lang.reflect.Method m)
Constructs a new Method object. |
Method Summary |
void |
code(ClassFile cf)
Generates the code for loading this field to stack. |
java.lang.Object |
eval(java.lang.Object obj,
java.lang.Object[] params)
Evaluates the member. |
java.lang.Class |
getDeclaringClass()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method
public Method(java.lang.reflect.Method m)
- Constructs a new Method object.
- Parameters:
m
- is corresponding java.lang.reflect.Method object.
Method
public Method(java.lang.reflect.Constructor c)
- Constructs a new Method object for a constructor.
- Parameters:
m
- is corresponding java.lang.reflect.Method object.
getDeclaringClass
public java.lang.Class getDeclaringClass()
- Overrides:
getDeclaringClass
in class LocalField
eval
public java.lang.Object eval(java.lang.Object obj,
java.lang.Object[] params)
throws java.lang.Exception
- Description copied from interface:
Member
- 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.
- Overrides:
eval
in class LocalField
- Following copied from interface:
gnu.jel.reflect.Member
- Parameters:
obj
- this pointer of corresponding object.params
- array of parameters wrapped in reflection objects.- Returns:
- the result wrapped in a reflection object.
code
public void code(ClassFile cf)
- Generates the code for loading this field to stack.
For field/variable invoke means to get value. No type checks are
performed.
- Overrides:
code
in class LocalMethod
- Parameters:
cf
- classfile to append instructions to.