public class BeanFunction extends AbstractFunction(Code)
One or more functions based on a Java-bean. Every setter method of the bean corresponds with one
parameter. The default value of the parameter can be defined with the getter method (which will
be called immediately after instantiation of such a Class).
All other methods (with no arguments) of the class correspond to the functions. So, you can
implement more bean-functions in the same class, as long as they have the same parameters.
A BeanFunction can be aquired via
FunctionFactory.getFunction(ClassString) (which
delegates to a static method in this class).
author: Michiel Meeuwissen version: $Id: BeanFunction.java,v 1.25 2008/02/03 17:33:57 nklasens Exp $ See Also:org.mmbase.util.functions.MethodFunction See Also:org.mmbase.util.functions.FunctionFactory since: MMBase-1.8
getFunction(Class claz, String name, Producer producer) Gives back a Function object based on the 'bean' concept.
Parameters: claz - The class which must be considered a 'bean' function Parameters: name - The name of the function (the name of a Method in the given class) Parameters: producer - An object that can produce in instance of the classclaz.
getFunctionValue(Parameters parameters) Instantiates the bean, calls all setters using the parameters, and executes the method associated with this function.
Utility function, searches an inner class of a given class. This inner class can perhaps be used as a
bean. Used in JSP/taglib.
Parameters: claz - The class to be considered Parameters: name - The name of the inner class throws: IllegalArgumentException - if claz has no inner class with that name
Gives back a Function object based on the 'bean' concept.
Parameters: claz - The class which must be considered a 'bean' function Parameters: name - The name of the function (the name of a Method in the given class) Parameters: producer - An object that can produce in instance of the classclaz. Defaults to a producer that simply calls claz.newInstance() since: MMBase-1.8.5
Utitily function to create an instance of a certain class. Two constructors are tried, a one
argument one, and if that fails, simply newInstance is used.
since: MMBase-1.8.5