|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.javelot.functionalj.Function
info.javelot.functionalj.ReflectionFunction
info.javelot.functionalj.ConstructorFunction
Represents a function that targets a constructor. Such a function does not use a
name nor an object on which to invoke the target. The constructors of the target
class are used, and the supplied parameters are forwarded to the Constructor.newInstance(Object[]) method when invoking the
target, returning the new instance that is created.
| Field Summary |
| Fields inherited from class info.javelot.functionalj.Function |
m_class, m_name, m_object, m_parameters, m_targets |
| Constructor Summary | |
ConstructorFunction(Class p_class)
Creates a function that targets the constructors of the given class. |
|
ConstructorFunction(Class p_class,
Object[] p_parameters)
Creates a function that targets the constructors of the given class which accept the supplied parameters. |
|
| Method Summary | |
protected Object[] |
getAllTargets(Class p_class)
Returns the constructors of the target class. |
protected int |
getInsertIndex(Object p_target)
Since constructors have no particular priority over one another, this method always returns 0 as the index at with to insert the target. |
protected Class[] |
getParameterTypes(Object p_target)
Returns the types of the parameters accepted by the constructor. |
protected Object |
invoke(Object p_target,
Object p_object,
Object[] p_parameters)
Invokes the Constructor.newInstance(Object[]) method
using the supplied parameters. |
boolean |
isObjectRequired()
Returns false since no object is required to invoke a
constructor. |
protected Function |
newInstance(Class p_class,
Object[] p_parameters)
Creates a new ConstructorFunction object using the specified
target class and parameters. |
Function |
object(Object p_object)
Throws a FunctionException, since no object is required to invoke a
constructor. |
| Methods inherited from class info.javelot.functionalj.ReflectionFunction |
call |
| Methods inherited from class info.javelot.functionalj.Function |
addParameter, addParameters, addParameters, addParameters, addParameters, addParameters, getName, getObject, getParameters, getTargetClass, getTargets, isObjectPresent, objectOrParameter, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ConstructorFunction(Class p_class)
p_class - the class that contains the constructors targetted by this
function.
public ConstructorFunction(Class p_class,
Object[] p_parameters)
throws FunctionException
p_class - the class that contains the constructors targetted by this
function.p_parameters - the parameters to be supplied to the constructor.
FunctionException - thrown if none of the target class's constructors
accept the supplied parameters.| Method Detail |
protected Object[] getAllTargets(Class p_class)
getAllTargets in class ReflectionFunctionp_class - the target class.
protected Class[] getParameterTypes(Object p_target)
getParameterTypes in class ReflectionFunctionp_target - the target constructor for which to determine the types of the
parameters.
protected int getInsertIndex(Object p_target)
0 as the index at with to insert the target.
getInsertIndex in class ReflectionFunctionp_target - the constructor for which to obtain the index.
0 in this case.
protected Object invoke(Object p_target,
Object p_object,
Object[] p_parameters)
throws FunctionException
Constructor.newInstance(Object[]) method
using the supplied parameters. Since there is no object needed on which to
invoke the target, it is not used.
invoke in class ReflectionFunctionp_target - the target constructor to invoke.p_object - not used.p_parameters - the parameters to pass to the constructor.
FunctionException - thrown if an exception occurs when invoking the
constructor.public boolean isObjectRequired()
false since no object is required to invoke a
constructor.
isObjectRequired in class Functionfalse.
protected Function newInstance(Class p_class,
Object[] p_parameters)
ConstructorFunction object using the specified
target class and parameters.
newInstance in class Functionp_class - the class of the target.p_parameters - the supplied parameters.
ConstructorFunction object of the target class,
containing the supplied parameters.
public Function object(Object p_object)
throws FunctionException
FunctionException, since no object is required to invoke a
constructor.
object in class FunctionFunctionException - always thrown since invoking this method is not
applicable to instances of the ConstructorFunction class.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||