|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.functions.CombinedFunction<R>
public class CombinedFunction<R>
A combined function combines other function objects. Depending on the provided filled paramters it calls the right function. So, it uses the function for which the provided parameters object matched best. The best match is determined by a kind of scoring mechanism. Every missing required parameter makes the function score very bad. Otherwise the rule is that the more parameters of the function are provided, the better it is.
| Constructor Summary | |
|---|---|
CombinedFunction(String name)
|
|
| Method Summary | |
|---|---|
void |
addFunction(Function<R> func)
|
Parameters |
createParameters()
Creates an empty 'Parameters' object for you, which you have to fill and feed back to getFunctionValue |
protected void |
determinDefinition()
Combines the parameter definitions of the wrapped function to one new parameter definition |
String |
getDescription()
|
R |
getFunctionValue(Parameters parameters)
Executes the defined function supplying the given arguments. |
R |
getFunctionValueWithArgs(Object... parameters)
A 'varargs' version of getFunctionValueWithList. |
R |
getFunctionValueWithList(List<?> parameters)
Executes the defined function supplying the given List of arguments. |
String |
getName()
A function must have a name. |
Parameter<?>[] |
getParameterDefinition()
|
ReturnType<R> |
getReturnType()
|
void |
setDescription(String description)
For documentational purposes a function object needs a description too. |
void |
setParameterDefinition(Parameter<?>[] params)
A function object is of no use, as long as it lacks a definition. |
void |
setReturnType(ReturnType<R> type)
Sets the return type of the function's result value. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CombinedFunction(String name)
| Method Detail |
|---|
public void addFunction(Function<R> func)
public Parameters createParameters()
Function
createParameters in interface Function<R>Function.getFunctionValue(Parameters)public R getFunctionValue(Parameters parameters)
Function
getFunctionValue in interface Function<R>parameters - The parameters for the function. To specify an empty parameter list use Parameters.VOID.
Implementors are encouraged to support null too.
Function.getReturnType()Function.createParameters()protected void determinDefinition()
public R getFunctionValueWithList(List<?> parameters)
FunctionFunction.getFunctionValue(Parameters).
getFunctionValueWithList in interface Function<R>parameters - The parameters for the function. To specify an empty parameter list use Parameters.VOID.
Function.getReturnType()public R getFunctionValueWithArgs(Object... parameters)
FunctiongetFunctionValueWithList.
getFunctionValueWithArgs in interface Function<R>public void setDescription(String description)
Function
setDescription in interface Function<R>public String getDescription()
getDescription in interface Function<R>Function.setDescription(String)public String getName()
Function
getName in interface Function<R>nullpublic Parameter<?>[] getParameterDefinition()
getParameterDefinition in interface Function<R>null if not set already.public void setParameterDefinition(Parameter<?>[] params)
Function
setParameterDefinition in interface Function<R>params - An array of Parameter objects.public ReturnType<R> getReturnType()
getReturnType in interface Function<R>null if unknown.public void setReturnType(ReturnType<R> type)
Function
setReturnType in interface Function<R>type - A ReturnType object. For void functions that could be ReturnType.VOID.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||