beanface.el.functor
Class FunctorStub<T>

java.lang.Object
  extended by beanface.el.functor.FunctorStub<T>
Type Parameters:
T - The base class which the target method is a member of.

public class FunctorStub<T>
extends java.lang.Object

Information identifying a static or dynamic method of a class, and optionally an instance of that class, that can be combined with parameters to form a functor.


Constructor Summary
FunctorStub(javax.el.ELContext context, FunctorIdentification functorIdent, T base, java.lang.Class<? extends T> baseClass, java.lang.reflect.Member method, boolean isDeferred, int specifiedParamCount)
           
FunctorStub(javax.el.ELContext context, FunctorIdentification functorIdent, T base, java.lang.Class<? extends T> baseClass, java.lang.String methodID)
           
 
Method Summary
 java.lang.Object applyParams(javax.el.ELContext context, java.lang.Object[] params)
          Invoke the method or constructor referenced by this functor stub passing in the given parameters.
 java.lang.String functionIdent()
          Constructs an identifier that would reference this functor.
 T getBase()
          The base object which this functor's method will apply to (may be null if the method is static or a constructor).
 java.lang.Class<? extends T> getBaseClass()
          The base class which this functor's method comes from (cannot be null).
 Functor<T> getFunctorParamZero(javax.el.ELContext context)
           
 java.lang.reflect.Member getMember()
          The Method or Constructor that this functor targets.
 int getParamCountRequired()
          Determine the mininum number of parameters that must be provided to this function before a result can be obtained.
 int getSpecifiedParamCount()
          The number of parameters explicitly specified in the method identifier.
 boolean hasVarArgs()
          Determine if the function was declared with a var-arg final parameter.
 boolean isDeferred()
          If the functor is deferred, the method will not be automatically invoked once the needed parameters have been provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctorStub

public FunctorStub(javax.el.ELContext context,
                   FunctorIdentification functorIdent,
                   T base,
                   java.lang.Class<? extends T> baseClass,
                   java.lang.String methodID)

FunctorStub

public FunctorStub(javax.el.ELContext context,
                   FunctorIdentification functorIdent,
                   T base,
                   java.lang.Class<? extends T> baseClass,
                   java.lang.reflect.Member method,
                   boolean isDeferred,
                   int specifiedParamCount)
Method Detail

getFunctorParamZero

public Functor<T> getFunctorParamZero(javax.el.ELContext context)

getBase

public T getBase()
The base object which this functor's method will apply to (may be null if the method is static or a constructor).


getBaseClass

public java.lang.Class<? extends T> getBaseClass()
The base class which this functor's method comes from (cannot be null).


getMember

public java.lang.reflect.Member getMember()
The Method or Constructor that this functor targets.

Returns:
the member.

getParamCountRequired

public int getParamCountRequired()
Determine the mininum number of parameters that must be provided to this function before a result can be obtained.

Returns:
the number of parameters required.

hasVarArgs

public boolean hasVarArgs()
Determine if the function was declared with a var-arg final parameter.

Returns:
true if the function has var-args.

applyParams

public java.lang.Object applyParams(javax.el.ELContext context,
                                    java.lang.Object[] params)
                             throws javax.el.ELException
Invoke the method or constructor referenced by this functor stub passing in the given parameters.

Parameters:
context - The EL context used to construct error messages when needed.
params - The parameters to pass to the method invocation.
Returns:
The result that was returned by the invoked method.
Throws:
javax.el.ELException

isDeferred

public boolean isDeferred()
If the functor is deferred, the method will not be automatically invoked once the needed parameters have been provided. Instead, the ".result" or other method can be invoked on the functor itself.

Returns:
flag to indicate if the functor is deferred.

getSpecifiedParamCount

public int getSpecifiedParamCount()
The number of parameters explicitly specified in the method identifier.

Returns:
the parameter count.

functionIdent

public java.lang.String functionIdent()
Constructs an identifier that would reference this functor.

Returns:
the functor identifier.