Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
instance
Reference to instance of class which will handle calls.
|
private java.lang.reflect.Method |
method
The method to be executed.
|
Constructor and Description |
---|
MethodInvoker(java.lang.Object instance,
java.lang.reflect.Method method)
Construct an instance that can make an invocation of a specific
local method.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
describe()
Return a text description of the method being invoked.
|
java.lang.Object |
invoke(java.lang.Object[] args)
Execute or "run" the object's functionality.
|
private java.lang.Object instance
private java.lang.reflect.Method method
public MethodInvoker(java.lang.Object instance, java.lang.reflect.Method method)
instance
- The object on which the method is invoked or null
if this method is static
.method
- The method to be executed.public java.lang.String describe()
public java.lang.Object invoke(java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface Invocable
args
- The method arguments or null
for no arguments.null
if
there is no return value. Note that this design does not
allow the caller to determine the difference between a
void
return and a return of a genuine
null
.java.lang.Throwable
- If the called method generates any exception or error.