|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.ipojo.util.Callback
public class Callback
A callback allows invoking a method on a POJO.
This class supports both public, protected and private methods of the
implementation class. This class also supports public method from super class.
The Method object is computed once and this computation is delayed
to the first invocation.
| Field Summary | |
|---|---|
private java.lang.String[] |
m_args
The argument classes. |
private boolean |
m_isStatic
Is the method a static method ? This implies calling the method on null |
private InstanceManager |
m_manager
The reference on the instance manager. |
private java.lang.String |
m_method
The name of the method to call. |
protected java.lang.reflect.Method |
m_methodObj
The method object. |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
private void |
computeArguments(java.lang.String[] args)
Computes arguments of the method. |
java.lang.String |
getMethod()
Gets the method name. |
protected void |
searchMethod()
Searches the Method object in the POJO by analyzing implementation
class methods. |
private java.lang.reflect.Method |
searchMethodInMethodArray(java.lang.reflect.Method[] methods)
Searches the Method in the given method arrays. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.reflect.Method m_methodObj
private java.lang.String m_method
private boolean m_isStatic
null
private InstanceManager m_manager
private java.lang.String[] m_args
| Constructor Detail |
|---|
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 methodCallback#computeArguments(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 method
public Callback(MethodMetadata method,
InstanceManager manager)
method - the MethodMetadata obtained from manipulation
metadata (PojoMetadata).manager - the instance manager.| Method Detail |
|---|
private void computeArguments(java.lang.String[] args)
args - the arguments of the method.FieldMetadata.getReflectionType(String)private java.lang.reflect.Method searchMethodInMethodArray(java.lang.reflect.Method[] methods)
Method in the given method arrays.
methods - the method array in which the method should be found
null if not found
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 instance
java.lang.NoSuchMethodException - if Method is not found in the class
java.lang.reflect.InvocationTargetException - if the method throws an exception
java.lang.IllegalAccessException - if the method can not be invoked
public 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 callback
null for
void method
java.lang.NoSuchMethodException - if the method was not found
java.lang.IllegalAccessException - if the method cannot be called
java.lang.reflect.InvocationTargetException - if an error happens in the method
public java.lang.Object call(java.lang.Object[] arg)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
arg - the method arguments
null for
void method, the last result for instance containing
several objects.
java.lang.NoSuchMethodException - if the callback method is not found
java.lang.IllegalAccessException - if the callback method cannot be called
java.lang.reflect.InvocationTargetException - if an error is thrown by the called method
public 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 array
null for
void method
java.lang.NoSuchMethodException - if the callback method is not found
java.lang.IllegalAccessException - if the callback method cannot be called
java.lang.reflect.InvocationTargetException - if an error is thrown by the called methodpublic java.lang.String getMethod()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||