com.glaivestone.javax.execution
Class ConstructorAction

java.lang.Object
  |
  +--com.glaivestone.javax.execution.AbstractEvaluableAction
        |
        +--com.glaivestone.javax.execution.ConstructorAction
All Implemented Interfaces:
EvaluableAction

public class ConstructorAction
extends AbstractEvaluableAction

An evaluable action which invokes a constructor to instantiate an object.

A number of static create factory methods are provided to make it easy to construct the common flavors of constructor actions. The creation services provide the notational simplicity of one-line expressions in initialization logic for common cases.

Author:
Deb Lewis

Field Summary
 
Fields inherited from class com.glaivestone.javax.execution.AbstractEvaluableAction
CONTINUABLE_HANDLER, DEFAULT_HANDLER, EMPTY_ARGS, EMPTY_PARM_TYPES, PROPAGATING_HANDLER, TERMINATING_HANDLER
 
Constructor Summary
ConstructorAction(java.lang.Class aClass, java.lang.reflect.Constructor aConstructor, java.lang.Object[] arguments, ExceptionHandler exceptionHandler)
          Construct a new ConstructorAction which invokes aConstructor to create a new instance of aClass.
 
Method Summary
static ConstructorAction create(java.lang.Class aClass)
          Create an action which will invoke the no-argument constructor to create a new instance of aClass when it is evaluated.
static ConstructorAction create(java.lang.Class aClass, java.lang.Class[] parmTypes)
          Create an action which will invoke the constructor with the argument type signature specified by the parmTypes argument types list to create a new instance of aClass when it is evaluated.
static ConstructorAction create(java.lang.Class aClass, java.lang.Class[] parmTypes, java.lang.Object[] args)
          Create an action which will invoke the constructor with the argument type signature specified by the parmTypes argument types list to create a new instance of aClass using the argument values in args when it is evaluated.
static ConstructorAction create(java.lang.Class aClass, java.lang.reflect.Constructor aConstructor, java.lang.Object[] args)
          Create an action which will invoke the constructor aConstructor to create a new instance of aClass using the argument values in args when it is evaluated.
 java.lang.Object evaluate(java.lang.Object[] args)
          Answer the result of evaluating the action with the given argument values.
static java.lang.reflect.Constructor findConstructor(java.lang.Class aClass)
          Answer the public no-argument constructor for aClass.
static java.lang.reflect.Constructor findConstructor(java.lang.Class aClass, java.lang.Class[] parmTypes)
          Answer the public constructor with the argument type signature specified by the parmTypes argument types list for aClass.
 java.lang.reflect.Constructor getConstructor()
          Answer the constructor which is invoked to evaluate this action.
 java.lang.String getSelector()
          Answer the name of the action.
 java.lang.String toString()
          Answer a string describing this action.
 
Methods inherited from class com.glaivestone.javax.execution.AbstractEvaluableAction
evaluate, evaluate, evaluate, getArguments, getNumberOfArguments, getOriginalException, getReceiver, setArguments, setExceptionHandler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructorAction

public ConstructorAction(java.lang.Class aClass,
                         java.lang.reflect.Constructor aConstructor,
                         java.lang.Object[] arguments,
                         ExceptionHandler exceptionHandler)
Construct a new ConstructorAction which invokes aConstructor to create a new instance of aClass. The default arguments are used if argument values are not supplied dynamically when the action is evaluated.

Method Detail

create

public static ConstructorAction create(java.lang.Class aClass)
Create an action which will invoke the no-argument constructor to create a new instance of aClass when it is evaluated.


create

public static ConstructorAction create(java.lang.Class aClass,
                                       java.lang.Class[] parmTypes)
Create an action which will invoke the constructor with the argument type signature specified by the parmTypes argument types list to create a new instance of aClass when it is evaluated.

The client must provide the argument values when the action is evaluated.


create

public static ConstructorAction create(java.lang.Class aClass,
                                       java.lang.Class[] parmTypes,
                                       java.lang.Object[] args)
Create an action which will invoke the constructor with the argument type signature specified by the parmTypes argument types list to create a new instance of aClass using the argument values in args when it is evaluated.

The client may override the default argument values of the action by providing actual argument values when the action is evaluated.


create

public static ConstructorAction create(java.lang.Class aClass,
                                       java.lang.reflect.Constructor aConstructor,
                                       java.lang.Object[] args)
Create an action which will invoke the constructor aConstructor to create a new instance of aClass using the argument values in args when it is evaluated.

The client may override the default argument values of the action by providing actual argument values when the action is evaluated.


findConstructor

public static java.lang.reflect.Constructor findConstructor(java.lang.Class aClass)
Answer the public no-argument constructor for aClass.


findConstructor

public static java.lang.reflect.Constructor findConstructor(java.lang.Class aClass,
                                                            java.lang.Class[] parmTypes)
Answer the public constructor with the argument type signature specified by the parmTypes argument types list for aClass.


evaluate

public java.lang.Object evaluate(java.lang.Object[] args)
Answer the result of evaluating the action with the given argument values.

Specified by:
evaluate in interface EvaluableAction
Specified by:
evaluate in class AbstractEvaluableAction
See Also:
EvaluableAction.evaluate()

getConstructor

public java.lang.reflect.Constructor getConstructor()
Answer the constructor which is invoked to evaluate this action.


getSelector

public java.lang.String getSelector()
Answer the name of the action.

Specified by:
getSelector in interface EvaluableAction
Specified by:
getSelector in class AbstractEvaluableAction
See Also:
EvaluableAction.getSelector()

toString

public java.lang.String toString()
Answer a string describing this action.

Overrides:
toString in class java.lang.Object

GFL 1.1 API