com.iternum.swlink.action
Class DelegateMethodAction

java.lang.Object
  extended bycom.iternum.swlink.action.AbstractAction
      extended bycom.iternum.swlink.action.DelegateMethodAction
All Implemented Interfaces:
Action

public class DelegateMethodAction
extends AbstractAction

A Action that invokes a delegate method on the target. This action supports four ways to define a delegate method

  1. A delegate with no parameters TargetClass.delegateMethod()
  2. A delegate that gets the source passed as an argument TargetClass.delegateMethod(Object pSource)
  3. A delegate that gets the extraArgs passed as an argument TargetClass.delegateMethod(Object pExtraArgs)
  4. A delegate that gets both the source and the extraArgs passed as an argument TargetClass.delegateMethod(Object pSource, Object pExtraArgs)
  5. Since the signatures of the methods are resolved at runtime, this Action may call any method whose parameters are assignable from the actual runtime parameters.

Author:
Karl F. Banke

Field Summary
static java.lang.String PARAM_METHOD_NAME
          Constant used for parametrization map.
static java.lang.String PARAM_PASS_EXTRA_ARGS
          Constant used for parametrization map.
static java.lang.String PARAM_PASS_SOURCE
          Constant used for parametrization map.
 
Constructor Summary
DelegateMethodAction()
          Default constructor.
DelegateMethodAction(java.lang.String pMethodName, boolean pPassSource, boolean pPassExtraArgs, boolean pReentrant)
           
 
Method Summary
 void close()
          Close this target action and remove its relationships.
 java.lang.String getMethodName()
           
 boolean isPassExtraArgs()
           
 boolean isPassSource()
           
 void performAction(java.lang.Object pSource, java.lang.Object pTarget, java.lang.Object pArgs)
          Invokes the method this link refers to.
 void setActionParam(java.util.Map pParam)
           
 void setMethodName(java.lang.String pMethodName)
           
 void setPassExtraArgs(boolean pPassExtraArgs)
           
 void setPassSource(boolean pPassSource)
           
 
Methods inherited from class com.iternum.swlink.action.AbstractAction
isReentrant, perform, setReentrant
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_METHOD_NAME

public static final java.lang.String PARAM_METHOD_NAME
Constant used for parametrization map.

See Also:
Constant Field Values

PARAM_PASS_SOURCE

public static final java.lang.String PARAM_PASS_SOURCE
Constant used for parametrization map.

See Also:
Constant Field Values

PARAM_PASS_EXTRA_ARGS

public static final java.lang.String PARAM_PASS_EXTRA_ARGS
Constant used for parametrization map.

See Also:
Constant Field Values
Constructor Detail

DelegateMethodAction

public DelegateMethodAction()
Default constructor.


DelegateMethodAction

public DelegateMethodAction(java.lang.String pMethodName,
                            boolean pPassSource,
                            boolean pPassExtraArgs,
                            boolean pReentrant)
Parameters:
pMethodName - The name of the method to invoke
pPassSource - Whether to use the source as argument
pPassExtraArgs - Whether to use the extraArgs as argument
pReentrant - true if this action is reentrant
Method Detail

performAction

public void performAction(java.lang.Object pSource,
                          java.lang.Object pTarget,
                          java.lang.Object pArgs)
Invokes the method this link refers to.

Specified by:
performAction in class AbstractAction
Parameters:
pSource - The source
pTarget - The target
pArgs - Additional arguments - ignored for this action
Throws:
LinkException
See Also:
Action.perform(java.lang.Object, java.lang.Object, java.lang.Object)

close

public void close()
Description copied from interface: Action
Close this target action and remove its relationships.

See Also:
Action.close()

getMethodName

public java.lang.String getMethodName()
Returns:
Returns the methodName.

setMethodName

public void setMethodName(java.lang.String pMethodName)
Parameters:
pMethodName - The methodName to set.

isPassSource

public boolean isPassSource()
Returns:
Returns true if the source of the invocation is to be passed as an argument

setPassSource

public void setPassSource(boolean pPassSource)
Parameters:
pPassSource - true if the source of the invocation is to be passed as an argument

isPassExtraArgs

public boolean isPassExtraArgs()
Returns:
Returns true if the extra arguments of the invacation are to be passed on the method call.

setPassExtraArgs

public void setPassExtraArgs(boolean pPassExtraArgs)
Parameters:
pPassExtraArgs - The passExtraArgs to set.

setActionParam

public void setActionParam(java.util.Map pParam)
Parameters:
pParam - A java.util.Map with up to three entries: A String and two Boolean with the keys defined as constants in this class.