org.mmbase.util.functions
Class FunctionProvider

java.lang.Object
  extended byorg.mmbase.util.functions.FunctionProvider
Direct Known Subclasses:
FunctionSet, IndexFunction, MMTable, Module, PatternNodeFunctionProvider

public abstract class FunctionProvider
extends Object

A function provider maintains a set of Function objects.

Since:
MMBase-1.8
Version:
$Id: FunctionProvider.java,v 1.11 2005/07/28 17:07:55 michiel Exp $
Author:
Pierre van Rooden

Field Summary
protected  Map functions
           
protected  Function getFunctions
          Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides.
 
Constructor Summary
FunctionProvider()
          The constructor of an FunctionProvider two things.
 
Method Summary
 void addFunction(Function function)
          Adds a function to the FunctionProvider.
 Parameters createParameters(String functionName)
          Creates a new empty Parameters object for given function.
 Function getFunction(String functionName)
          Returns the Function object with given name.
 Collection getFunctions()
          Returns a Collection of all functions currently provided by the FunctionProvider.
 Object getFunctionValue(String functionName, List parameters)
          Executes a function, and returns the function value.
protected  Function newFunctionInstance(String name, Parameter[] parameters, ReturnType returnType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

functions

protected Map functions

getFunctions

protected Function getFunctions
Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides.

Constructor Detail

FunctionProvider

public FunctionProvider()
The constructor of an FunctionProvider two things. It adds the 'getFunction' function, and it guesses other function using reflection.

To Do:
Should this last thing not only be done on MMObjectBuilders?
Method Detail

newFunctionInstance

protected Function newFunctionInstance(String name,
                                       Parameter[] parameters,
                                       ReturnType returnType)

addFunction

public void addFunction(Function function)
Adds a function to the FunctionProvider. So, you can implement any function and add it to the provider, to make it provide this function too.


createParameters

public Parameters createParameters(String functionName)
Creates a new empty Parameters object for given function.

Returns:
A new empty Parameters object, or null if no such function.

getFunctionValue

public Object getFunctionValue(String functionName,
                               List parameters)
Executes a function, and returns the function value.

Returns:
The function value or null if no such function.

getFunction

public Function getFunction(String functionName)
Returns the Function object with given name.

Returns:
Function object or null if no such function is provided.

getFunctions

public Collection getFunctions()
Returns a Collection of all functions currently provided by the FunctionProvider.



MMBase build 1.8.1.20060716