Package repast.simphony.engine.schedule
Class CallBackAction
java.lang.Object
repast.simphony.engine.schedule.CallBackAction
- All Implemented Interfaces:
IAction
An IAction created from a method name and method parameters. When a CallBackAction is executed
it will call the named method passing the parameters.
- Version:
- $Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
- Author:
- Nick Collier
-
Constructor Summary
ConstructorDescriptionCallBackAction
(Object target, Method method) Creates a CallBackAction from the specified target and method.CallBackAction
(Object target, Method method, Object... parameters) Creates a CallBackAction from the specified target, method and parameters.CallBackAction
(Object target, String methodName, Object... parameters) Creates a CallBackAction from the specified target, method name, and method parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Calls the method named in the constructor on the target named in the constructor.Object[]
getArgs()
net.sf.cglib.reflect.FastMethod
Gets the method that this callback action will call.void
Sets the argument that is passed to the wrapped method.void
Sets the target of the method call.
-
Constructor Details
-
CallBackAction
Creates a CallBackAction from the specified target and method. When executed, the CallBackAction will call the the method on the target.- Parameters:
target
- the object to call the method onmethod
- the method to call
-
CallBackAction
Creates a CallBackAction from the specified target, method and parameters. When executed, the CallBackAction will call the the method on the target passing the parameters.- Parameters:
target
- the object to call the method onmethod
- the method to callparameters
- the parameters to pass to the method call
-
CallBackAction
Creates a CallBackAction from the specified target, method name, and method parameters. When executed, the CallBack action will call the named method on the target passing the specified parameters.- Parameters:
target
- the object to call the method onmethodName
- the name of the method to callparameters
- the parameters to pass to the method- Throws:
IllegalArgumentException
- if the target does not contain a method with the appropriate signature.
-
-
Method Details
-
setArgs
Sets the argument that is passed to the wrapped method. Note that using this method is only necessary if the parameters passed into the constructor do not act as references. For example, if an int value is passed in the constructor that int value will be automatically updated as a reference to some other int value. This method allows client code to set the value of that int.- Parameters:
index
- the index into the argument arrayarg
- the argument to pass to the method
-
getArgs
-
execute
public void execute()Calls the method named in the constructor on the target named in the constructor. -
getMethodName
- Returns:
- the name of the method to be called on the target object.
-
getMethod
Gets the method that this callback action will call.- Returns:
- the method that this callback action will call.
-
getFastMethod
public net.sf.cglib.reflect.FastMethod getFastMethod() -
getTarget
- Returns:
- the target object whose method will be called in the execution of this action.
-
setTarget
Sets the target of the method call.- Parameters:
obj
- the new target of the method call
-