org.mmbase.util.functions
Class MethodFunction

java.lang.Object
  extended byorg.mmbase.util.functions.AbstractFunction
      extended byorg.mmbase.util.functions.MethodFunction
All Implemented Interfaces:
Comparable, Function, Serializable

public class MethodFunction
extends AbstractFunction

A function based on an abritrary method. Since the name of the parameters cannot be found by reflection, this is only of limited use. Normally you would probably better use BeanFunction. A method-function can come in handy on JSP's.

Since:
MMBase-1.7
Version:
$Id: MethodFunction.java,v 1.4 2005/10/01 20:17:36 michiel Exp $
Author:
Michiel Meeuwissen
See Also:
MMObjectBuilder.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List), Node.getFunctionValue(java.lang.String, java.util.List), BeanFunction, Serialized Form

Field Summary
 
Fields inherited from class org.mmbase.util.functions.AbstractFunction
name, returnType
 
Constructor Summary
MethodFunction(Method method, String name)
           
 
Method Summary
static Function getFunction(Method method, String name)
           
 Object getFunctionValue(Parameters parameters)
          Executes the defined function supplying the given arguments.
 
Methods inherited from class org.mmbase.util.functions.AbstractFunction
compareTo, createParameters, equals, getDescription, getFunctionValueWithList, getName, getParameterDefinition, getReturnType, hashCode, setDescription, setParameterDefinition, setReturnType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodFunction

public MethodFunction(Method method,
                      String name)
Method Detail

getFunction

public static Function getFunction(Method method,
                                   String name)

getFunctionValue

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

Specified by:
getFunctionValue in interface Function
Specified by:
getFunctionValue in class AbstractFunction
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 AbstractFunction.getReturnType()
See Also:
AbstractFunction.createParameters()


MMBase build 1.8.1.20060716