beanface.el.functor
Class TagLibFunctions

java.lang.Object
  extended by beanface.el.functor.TagLibFunctions

public class TagLibFunctions
extends java.lang.Object

A collection of static methods to be exposed as Tag Library functions.


Constructor Summary
TagLibFunctions()
           
 
Method Summary
static java.lang.Object constructor(java.lang.String className, int paramCount, boolean deferred)
          Build a functor for a constructor.
static
<T> java.lang.Object
dynamicMethod(T base, java.lang.String methodName, int paramCount, boolean deferred)
          Build a functor for a dynamic method.
static java.lang.Object invokeConstructor(java.lang.String className, java.lang.Object params)
          Invoke a constructor.
static
<T> java.lang.Object
invokeDynamic(T base, java.lang.String methodName, java.lang.Object params)
          Invoke a dynamic method
static java.lang.Object invokeStatic(java.lang.String className, java.lang.String methodName, java.lang.Object params)
          Invoke a static method.
static FunctionParameters params(java.lang.Object... params)
          Construct a FunctionParameters object wrapping the given parameters.
static FunctionParameters params0()
           
static FunctionParameters params1(java.lang.Object a)
           
static FunctionParameters params2(java.lang.Object a, java.lang.Object b)
           
static FunctionParameters params3(java.lang.Object a, java.lang.Object b, java.lang.Object c)
           
static FunctionParameters params4(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d)
           
static java.lang.Object staticField(java.lang.String className, java.lang.String fieldName)
          Obtain the value of a static field.
static java.lang.Object staticMethod(java.lang.String className, java.lang.String methodName, int paramCount, boolean deferred)
          Build a functor for a static method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagLibFunctions

public TagLibFunctions()
Method Detail

dynamicMethod

public static <T> java.lang.Object dynamicMethod(T base,
                                                 java.lang.String methodName,
                                                 int paramCount,
                                                 boolean deferred)
Build a functor for a dynamic method.

Type Parameters:
T - The type of the base object.
Parameters:
base - The object on which the method will be invoked.
methodName - The name of the dynamic method.
paramCount - The explicit number of parameters to be applied.
deferred - flag to request a deferred functor instead of a standard one.
Returns:
the functor object, or the result of invoking the method (if paramCount is 0 and deferred is false).

constructor

public static java.lang.Object constructor(java.lang.String className,
                                           int paramCount,
                                           boolean deferred)
Build a functor for a constructor.

Parameters:
className - The fully qualified name of the class to construct.
paramCount - The explicit number of parameters to be applied.
deferred - flag to request a deferred functor instead of a standard one.
Returns:
the functor object, or the result of invoking the constructor (if paramCount is 0 and deferred is false).

staticMethod

public static java.lang.Object staticMethod(java.lang.String className,
                                            java.lang.String methodName,
                                            int paramCount,
                                            boolean deferred)
Build a functor for a static method.

Parameters:
className - The fully qualified name of the class containing the method.
methodName - The name of the static method.
paramCount - The explicit number of parameters to be applied.
deferred - flag to request a deferred functor instead of a standard one.
Returns:
the functor object, or the result of invoking the method (if paramCount is 0 and deferred is false).

staticField

public static java.lang.Object staticField(java.lang.String className,
                                           java.lang.String fieldName)
Obtain the value of a static field.

Parameters:
className - The fully qualified name of the class containing the static field.
fieldName - The name of the field.
Returns:
The value of the field.

params

public static FunctionParameters params(java.lang.Object... params)
Construct a FunctionParameters object wrapping the given parameters.

Parameters:
params - the method parameters to be wrapped.
Returns:
the FunctionParameters object wrapping the params.

params0

public static FunctionParameters params0()

params1

public static FunctionParameters params1(java.lang.Object a)

params2

public static FunctionParameters params2(java.lang.Object a,
                                         java.lang.Object b)

params3

public static FunctionParameters params3(java.lang.Object a,
                                         java.lang.Object b,
                                         java.lang.Object c)

params4

public static FunctionParameters params4(java.lang.Object a,
                                         java.lang.Object b,
                                         java.lang.Object c,
                                         java.lang.Object d)

invokeDynamic

public static <T> java.lang.Object invokeDynamic(T base,
                                                 java.lang.String methodName,
                                                 java.lang.Object params)
Invoke a dynamic method

Type Parameters:
T - The class containing the method to invoke.
Parameters:
base - The base object on which to apply the method.
methodName - The name of the method to invoke.
params - Either a single parameter to be passed to the method, or a FunctionParameters object containing all the parameters to be passed to the method.
Returns:
The result of invoking the named method (or null if it doesn't exist).

invokeStatic

public static java.lang.Object invokeStatic(java.lang.String className,
                                            java.lang.String methodName,
                                            java.lang.Object params)
Invoke a static method.

Parameters:
className - The name of the class containing the method to be invoked.
methodName - The name of the method to invoke.
params - Either a single parameter to be passed to the method, or a FunctionParameters object containing all the parameters to be passed to the method.
Returns:
The result of invoking the named method (or null if it doesn't exist).

invokeConstructor

public static java.lang.Object invokeConstructor(java.lang.String className,
                                                 java.lang.Object params)
Invoke a constructor.

Parameters:
className - The name of the class to construct.
params - Either a single parameter to be passed to the constructor, or a FunctionParameters object containing all the parameters to be passed to the constructor.
Returns:
The new object instance.