org.mmbase.util.functions
Class WrappedFunction<R>

java.lang.Object
  extended by org.mmbase.util.functions.WrappedFunction<R>
All Implemented Interfaces:
Function<R>

public abstract class WrappedFunction<R>
extends Object
implements Function<R>

A wrapped function is a base class for function objects based on an other function object.

Since:
MMBase-1.8
Version:
$Id: WrappedFunction.java 41943 2010-04-16 17:18:19Z michiel $
Author:
Pierre van Rooden

Field Summary
protected  Function<R> wrappedFunction
           
 
Constructor Summary
WrappedFunction(Function<R> function)
          Constructor for Basic Function
 
Method Summary
 Parameters createParameters()
          Creates an empty 'Parameters' object for you, which you have to fill and feed back to getFunctionValue
 boolean equals(Object obj)
           
 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()
           
 int hashCode()
           
 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, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

wrappedFunction

protected Function<R> wrappedFunction
Constructor Detail

WrappedFunction

public WrappedFunction(Function<R> function)
Constructor for Basic Function

Parameters:
function - The function to wrap
Method Detail

createParameters

public Parameters createParameters()
Description copied from interface: Function
Creates an empty 'Parameters' object for you, which you have to fill and feed back to getFunctionValue

Specified by:
createParameters in interface Function<R>
See Also:
Function.getFunctionValue(Parameters)

getFunctionValue

public R getFunctionValue(Parameters parameters)
Description copied from interface: Function
Executes the defined function supplying the given arguments.

Specified by:
getFunctionValue in interface Function<R>
Parameters:
parameters - The parameters for the function. To specify an empty parameter list use Parameters.VOID. Implementors are encouraged to support null too.
Returns:
The function value, which can be of any type compatible to Function.getReturnType()
See Also:
Function.createParameters()

getFunctionValueWithList

public R getFunctionValueWithList(List<?> parameters)
Description copied from interface: Function
Executes the defined function supplying the given List of arguments. This is a convenience method, as the List is mapped to a Parameters type and passed to Function.getFunctionValue(Parameters).

Specified by:
getFunctionValueWithList in interface Function<R>
Parameters:
parameters - The parameters for the function. To specify an empty parameter list use Parameters.VOID.
Returns:
The function value, which can be of any type compatible to Function.getReturnType()

getFunctionValueWithArgs

public R getFunctionValueWithArgs(Object... parameters)
Description copied from interface: Function
A 'varargs' version of getFunctionValueWithList.

Specified by:
getFunctionValueWithArgs in interface Function<R>

setDescription

public void setDescription(String description)
Description copied from interface: Function
For documentational purposes a function object needs a description too.

Specified by:
setDescription in interface Function<R>

getDescription

public String getDescription()
Specified by:
getDescription in interface Function<R>
See Also:
Function.setDescription(String)

getName

public String getName()
Description copied from interface: Function
A function must have a name. This is the name which was used to aquire the function object.

Specified by:
getName in interface Function<R>
Returns:
The function's name, never null

getParameterDefinition

public Parameter<?>[] getParameterDefinition()
Specified by:
getParameterDefinition in interface Function<R>
Returns:
The currently set Parameter definition array, or null if not set already.

setParameterDefinition

public void setParameterDefinition(Parameter<?>[] params)
Description copied from interface: Function
A function object is of no use, as long as it lacks a definition.

Specified by:
setParameterDefinition in interface Function<R>
Parameters:
params - An array of Parameter objects.

getReturnType

public ReturnType<R> getReturnType()
Specified by:
getReturnType in interface Function<R>
Returns:
The return type of the function's result value, or null if unknown.

setReturnType

public void setReturnType(ReturnType<R> type)
Description copied from interface: Function
Sets the return type of the function's result value.

Specified by:
setReturnType in interface Function<R>
Parameters:
type - A ReturnType object. For void functions that could be ReturnType.VOID.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null