org.mmbase.util.functions
Class SetFunction

java.lang.Object
  extended by org.mmbase.util.functions.AbstractFunction<Object>
      extended by org.mmbase.util.functions.SetFunction
All Implemented Interfaces:
Serializable, Comparable<Function<Object>>, Function<Object>

public class SetFunction
extends AbstractFunction<Object>

A SetFunction is a Function which wraps precisely one method of a class. It is used as one function of a 'set' of functions.

Since:
MMBase-1.8
Version:
$Id: SetFunction.java 42625 2010-06-21 09:47:28Z michiel $
Author:
Michiel Meeuwissen, Daniel Ockeloen, Pierre van Rooden
See Also:
FunctionSets, Serialized Form

Nested Class Summary
static class SetFunction.Type
           
 
Field Summary
 
Fields inherited from class org.mmbase.util.functions.AbstractFunction
autoReturnType, name, returnType
 
Constructor Summary
SetFunction(String name, Parameter[] def, Class clazz)
           
SetFunction(String name, Parameter[] def, ReturnType<Object> returnType, Class functionClass, String methodName, SetFunction.Type type)
           
 
Method Summary
 Object getFunctionValue(Parameters parameters)
          Executes the defined function supplying the given arguments.
protected  Object getInstance()
           
protected static Method getMethod(Class functionClass, String methodName, Parameters parameters)
          Finds a method of a class more or less 'fuzzy'.
(package private)  Object[] getValues(Parameters params)
           
protected static Class<?> sophisticate(Class<?> primitive)
          Simple utility method to convert primitive classes to their 'sophisticated' counterparts.
 
Methods inherited from class org.mmbase.util.functions.AbstractFunction
compareTo, createParameters, equals, getDescription, getFunctionValueWithArgs, 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

SetFunction

SetFunction(String name,
            Parameter[] def,
            ReturnType<Object> returnType,
            Class functionClass,
            String methodName,
            SetFunction.Type type)

SetFunction

public SetFunction(String name,
                   Parameter[] def,
                   Class clazz)
Since:
MMBase-1.8.5
Method Detail

sophisticate

protected static Class<?> sophisticate(Class<?> primitive)
Simple utility method to convert primitive classes to their 'sophisticated' counterparts.

Since:
MMBase-1.8.5

getMethod

protected static Method getMethod(Class functionClass,
                                  String methodName,
                                  Parameters parameters)
Finds a method of a class more or less 'fuzzy'. Depending on e.g. Casting.canCast(java.lang.Class, java.lang.Class).

Since:
MMBase-1.9.2

getValues

Object[] getValues(Parameters params)
Since:
MMBase-1.9.2

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

getInstance

protected Object getInstance()


MMBase 2.0-SNAPSHOT - null