|
||||||||||
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 | |
---|---|
protected Method |
m_methodObj
The method object. |
Constructor Summary | |
---|---|
Callback(MethodMetadata method,
InstanceManager manager)
Creates a Callback. |
|
Callback(String method,
Class[] args,
boolean isStatic,
InstanceManager manager)
Creates a Callback. |
|
Callback(String method,
String[] args,
boolean isStatic,
InstanceManager manager)
Creates a Callback. |
Method Summary | |
---|---|
Object |
call()
Invokes the method without arguments. |
Object |
call(Object instance)
Invokes the method without arguments. |
Object |
call(Object[] arg)
Invokes the method on every created objects with the specified arguments. |
Object |
call(Object instance,
Object[] arg)
Invokes the method on the given object with the specified arguments. |
String[] |
getArguments()
Gets the method arguments. |
String |
getMethod()
Gets the method name. |
protected void |
searchMethod()
Searches the Method object in the POJO by analyzing implementation
class methods. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Method m_methodObj
Constructor Detail |
---|
public Callback(String method, 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(String method, 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.Method Detail |
---|
protected void searchMethod() throws NoSuchMethodException
Method
object in the POJO by analyzing implementation
class methods. The name of the method and the argument type are checked.
NoSuchMethodException
- if the method cannot be found either in the
implementation class or in parent classes.public Object call() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
null
for void
method, the last result for multi-object instance
NoSuchMethodException
- if Method is not found in the class
InvocationTargetException
- if the method throws an exception
IllegalAccessException
- if the method can not be invokedpublic Object call(Object instance) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
instance
- the instance on which call the callback
null
for
void
method
NoSuchMethodException
- if the method was not found
IllegalAccessException
- if the method cannot be called
InvocationTargetException
- if an error happens in the methodpublic Object call(Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
arg
- the method arguments
null
for
void
method, the last result for instance containing
several objects.
NoSuchMethodException
- if the callback method is not found
IllegalAccessException
- if the callback method cannot be called
InvocationTargetException
- if an error is thrown by the called methodpublic Object call(Object instance, Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
instance
- the instance on which call the methodarg
- the argument array
null
for
void
method
NoSuchMethodException
- if the callback method is not found
IllegalAccessException
- if the callback method cannot be called
InvocationTargetException
- if an error is thrown by the called methodpublic String getMethod()
public String[] getArguments()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |