org.mmbase.util.functions
Class WrappedFunction

java.lang.Object
  extended byorg.mmbase.util.functions.WrappedFunction
All Implemented Interfaces:
Function

public abstract class WrappedFunction
extends Object
implements Function

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

Since:
MMBase-1.8
Version:
$Id: WrappedFunction.java,v 1.9 2005/10/18 21:51:30 michiel Exp $
Author:
Pierre van Rooden

Field Summary
protected  Function wrappedFunction
           
 
Constructor Summary
WrappedFunction(Function 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
 String getDescription()
           
 Object getFunctionValue(Parameters parameters)
          Executes the defined function supplying the given arguments.
 Object getFunctionValueWithList(List parameters)
          Executes the defined function supplying the given List of arguments.
 String getName()
          A function must have a name.
 Parameter[] getParameterDefinition()
           
 ReturnType 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 type)
          Sets the return type of the function's result value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

wrappedFunction

protected Function wrappedFunction
Constructor Detail

WrappedFunction

public WrappedFunction(Function 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
See Also:
Function.getFunctionValue(Parameters)

getFunctionValue

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

Specified by:
getFunctionValue in interface Function
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 Object 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
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()

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

getDescription

public String getDescription()
Specified by:
getDescription in interface Function
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
Returns:
The function's name, never null

getParameterDefinition

public Parameter[] getParameterDefinition()
Specified by:
getParameterDefinition in interface Function
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
Parameters:
params - An array of Parameter objects.

getReturnType

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

setReturnType

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

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

hashCode

public int hashCode()

toString

public String toString()


MMBase build 1.8.1.20060716