| java.lang.Object org.mmbase.util.functions.Functions
Functions | public class Functions (Code) | | 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.
since: MMBase-1.8 author: Pierre van Rooden author: Daniel Ockeloen author: Michiel Meeuwissen version: $Id: Functions.java,v 1.17 2007/11/25 18:25:49 nklasens Exp $ |
buildParameters | public static Parameters buildParameters(Parameter>[] def, List> args)(Code) | | Converts a certain List to an Parameters if it is not already one.
|
getParameterDefinitonsByReflection | public static Map<String, Parameter<?>[]> getParameterDefinitonsByReflection(Class> clazz, Map<String, Parameter<?>[]> map)(Code) | | 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),
Parameter.LANGUAGE
}
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 instead.
See Also: Parameter Parameters: clazz - the class to perform reflection on. Parameters: map - A map of parameter definitions (Parameter[] objects), keys by function name (String) |
|
|