public class BeanFunction extends AbstractFunction<Object>
FunctionFactory.getFunction(Class, String) (which
delegates to a static method in this class).MethodFunction,
FunctionFactory,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
BeanFunction.Producer
A producer can instantiate beans
|
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
NCName |
autoReturnType, name, returnType| Constructor and Description |
|---|
BeanFunction(Object bean,
String name) |
| Modifier and Type | Method and Description |
|---|---|
static Class |
getClass(Class claz,
String name)
Utility function, searches an inner class of a given class.
|
static DataType |
getDataType(String value,
BasicDataType base)
Given a string and a 'base' datatype, produces a new
DataType. |
static BeanFunction |
getFunction(Class claz,
String name)
This defaulting version of
getFunction(Class, String, Producer) uses a producer that uses Class.newInstance(). |
static BeanFunction |
getFunction(Class claz,
String name,
BeanFunction.Producer producer)
Gives back a Function object based on the 'bean' concept.
|
Object |
getFunctionValue(Parameters parameters)
Executes the defined function supplying the given arguments.
|
static <C> C |
getInstance(Class<C> claz,
Object constructorArgument)
Utitily function to create an instance of a certain class.
|
static Parameter<?>[] |
getParameterDefinition(Object sampleInstance,
List<Method> setMethods) |
BeanFunction.Producer |
getProducer() |
static void |
main(String[] argv) |
static void |
setParameters(Object b,
Parameters parameters,
List<Method> setMethods) |
compareTo, createParameters, equals, getDescription, getFunctionValueWithList, getName, getParameterDefinition, getReturnType, hashCode, setDescription, setParameterDefinition, setReturnType, toStringpublic static final Pattern NCName
public BeanFunction(Object bean, String name) throws IllegalAccessException, InstantiationException, InvocationTargetException, DependencyException
IllegalAccessExceptionInstantiationExceptionInvocationTargetExceptionDependencyExceptionpublic static Class getClass(Class claz, String name)
claz - The class to be consideredname - The name of the inner classIllegalArgumentException - if claz has no inner class with that namepublic static BeanFunction getFunction(Class claz, String name, BeanFunction.Producer producer) throws IllegalAccessException, InstantiationException, InvocationTargetException, DependencyException
claz - The class which must be considered a 'bean' functionname - The name of the function (the name of a Method in the given class)producer - An object that can produce in instance of the class
claz. Defaults to a producer that simply calls Class.newInstance().IllegalAccessExceptionInstantiationExceptionInvocationTargetExceptionDependencyExceptionpublic static BeanFunction getFunction(Class claz, String name) throws IllegalAccessException, InstantiationException, InvocationTargetException, DependencyException
getFunction(Class, String, Producer) uses a producer that uses Class.newInstance().
Called from FunctionFactorypublic static <C> C getInstance(Class<C> claz, Object constructorArgument) throws IllegalAccessException, InstantiationException, InvocationTargetException
IllegalAccessExceptionInstantiationExceptionInvocationTargetExceptionpublic static Parameter<?>[] getParameterDefinition(Object sampleInstance, List<Method> setMethods) throws IllegalAccessException, InvocationTargetException, DependencyException
IllegalAccessExceptionInvocationTargetExceptionDependencyExceptionpublic static void setParameters(Object b, Parameters parameters, List<Method> setMethods) throws IllegalAccessException, InvocationTargetException
b - The 'bean' on which the setter methods must be invokedparameters - The object containing the parameter valuessetMethods - The setter methodsIllegalAccessExceptionInvocationTargetExceptionpublic static DataType getDataType(String value, BasicDataType base) throws DependencyException
DataType. If the string matches
NCName then the datatype is looked up in the MMBase DataType repository at DataTypes.getDataType(java.lang.String). Otherwise the String is interpreted as a piece
of XML.DependencyExceptionpublic BeanFunction.Producer getProducer()
public Object getFunctionValue(Parameters parameters)
getFunctionValue in interface Function<Object>getFunctionValue in class AbstractFunction<Object>parameters - The parameters for the function. To specify an empty parameter list use Parameters.VOID.
Implementors are encouraged to support null too.AbstractFunction.getReturnType()AbstractFunction.createParameters()MMBase 1.9-SNAPSHOT - ${javadoctimestamp}