public class Callback
extends java.lang.Object
Method
object is computed once and this computation is delayed
to the first invocation.Modifier and Type | Field and Description |
---|---|
protected java.lang.reflect.Method |
m_methodObj
The method object.
|
Constructor and Description |
---|
Callback(MethodMetadata method,
InstanceManager manager)
Creates a Callback.
|
Callback(java.lang.String method,
java.lang.Class[] args,
boolean isStatic,
InstanceManager manager)
Creates a Callback.
|
Callback(java.lang.String method,
java.lang.String[] args,
boolean isStatic,
InstanceManager manager)
Creates a Callback.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
call()
Invokes the method without arguments.
|
java.lang.Object |
call(java.lang.Object instance)
Invokes the method without arguments.
|
java.lang.Object |
call(java.lang.Object[] arg)
Invokes the method on every created objects with the specified
arguments.
|
java.lang.Object |
call(java.lang.Object instance,
java.lang.Object[] arg)
Invokes the method on the given object with the specified
arguments.
|
java.lang.String[] |
getArguments()
Gets the method arguments.
|
java.lang.String |
getMethod()
Gets the method name.
|
protected void |
searchMethod()
Searches the
Method object in the POJO by analyzing implementation
class methods. |
protected java.lang.reflect.Method m_methodObj
public Callback(java.lang.String method, java.lang.String[] args, boolean isStatic, InstanceManager manager)
method
- the name of the method to callargs
- the argument type name, or null
if no argumentsisStatic
- is the method a static methodmanager
- the instance manager of the component containing the methodcomputeArguments(String[])
public Callback(java.lang.String method, java.lang.Class[] args, boolean isStatic, InstanceManager manager)
method
- the the name of the method to callargs
- the argument classesisStatic
- the is the method a static methodmanager
- the the instance manager of the component containing the methodpublic Callback(MethodMetadata method, InstanceManager manager)
method
- the MethodMetadata
obtained from manipulation
metadata (PojoMetadata
).manager
- the instance manager.protected void searchMethod() throws java.lang.NoSuchMethodException
Method
object in the POJO by analyzing implementation
class methods. The name of the method and the argument type are checked.java.lang.NoSuchMethodException
- if the method cannot be found either in the
implementation class or in parent classes.public java.lang.Object call() throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
null
for void
method, the last result for multi-object instancejava.lang.NoSuchMethodException
- if Method is not found in the classjava.lang.reflect.InvocationTargetException
- if the method throws an exceptionjava.lang.IllegalAccessException
- if the method can not be invokedpublic java.lang.Object call(java.lang.Object instance) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
instance
- the instance on which call the callbacknull
for
void
methodjava.lang.NoSuchMethodException
- if the method was not foundjava.lang.IllegalAccessException
- if the method cannot be calledjava.lang.reflect.InvocationTargetException
- if an error happens in the methodpublic java.lang.Object call(java.lang.Object[] arg) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
arg
- the method argumentsnull
for
void
method, the last result for instance containing
several objects.java.lang.NoSuchMethodException
- if the callback method is not foundjava.lang.IllegalAccessException
- if the callback method cannot be calledjava.lang.reflect.InvocationTargetException
- if an error is thrown by the called methodpublic java.lang.Object call(java.lang.Object instance, java.lang.Object[] arg) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
instance
- the instance on which call the methodarg
- the argument arraynull
for
void
methodjava.lang.NoSuchMethodException
- if the callback method is not foundjava.lang.IllegalAccessException
- if the callback method cannot be calledjava.lang.reflect.InvocationTargetException
- if an error is thrown by the called methodpublic java.lang.String getMethod()
public java.lang.String[] getArguments()
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.