Class Functions

  extended byorg.mmbase.util.functions.Functions

public class Functions
extends Object

This class defines static methods for defining Function and Parameters objects. These methods include ways to retrieve Function definitions for a class using reflection, and methods to convert a List to a Parameters object, and a Parameter array to a List.

$Id:,v 1.12 2006/01/13 15:37:24 pierre Exp $
Pierre van Rooden, Daniel Ockeloen, Michiel Meeuwissen

Constructor Summary
Method Summary
static Parameters buildParameters(Parameter[] def, List args)
          Converts a certain List to an Parameters if it is not already one.
static List define(Parameter[] def, List list)
          Adds the definitions to a List.
static Method getMethodFromClass(Class claz, String name)
static Map getParameterDefinitonsByReflection(Class clazz, Map map)
          Generates a map of Parameter[] objects for a given class through reflection.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Functions()
Method Detail


public static Parameters buildParameters(Parameter[] def,
                                         List args)
Converts a certain List to an Parameters if it is not already one.


public static List define(Parameter[] def,
                          List list)
Adds the definitions to a List. Resolves the Parameter.Wrapper's (recursively).

List with only simple Parameter's.


public static Method getMethodFromClass(Class claz,
                                        String name)
Warning: No Java Documentation Available.


public static Map getParameterDefinitonsByReflection(Class clazz,
                                                     Map map)
Generates a map of Parameter[] objects for a given class through reflection. The map keys are the names of te function the Parameter[] object belongs to.
The method parses the given class for constants (final static public members) of type Parameter[]. The member name up to the first underscore in that name is considered the name for a function supported by that class. i.e. :
    public final static Parameter[] AGE_PARAMETERS = {};
defines a function 'age' which takes no parameters.
    public final static Parameter[] GUI_PARAMETERS = {
        new Parameter("field", String.class),
defines a function 'gui' which two parameters: 'field' and 'language'. Results form reflection are stored in an internal cache. The method returns the Parameter[] value (if any) of the function whose name was given in the call. If the function cannot be derived through reflection, the method returns null.
Note that, since this way of determining functions cannot determine return value types, it is advised to use FunctionProvider.addFunction(org.mmbase.util.functions.Function) instead.

clazz - the class to perform reflection on.
map -
A map of parameter definitions (Parameter[] objects), keys by function name (String)
See Also:

MMBase build