org.mmbase.module.core
Class MMObjectNodeFunction<R>

Package class diagram package MMObjectNodeFunction
java.lang.Object
  extended by org.mmbase.util.functions.AbstractFunction<R>
      extended by org.mmbase.util.functions.NodeFunction<R>
          extended by org.mmbase.module.core.MMObjectNodeFunction<R>
All Implemented Interfaces:
Serializable, Comparable<Function<R>>, Function<R>
Direct Known Subclasses:
GuiFunction

public abstract class MMObjectNodeFunction<R>
extends NodeFunction<R>

Sometimes you may want to implement a function on a node based on an MMObjectNode instance. This provides getCoreNode(org.mmbase.module.core.MMObjectBuilder, org.mmbase.bridge.Node), which can be used to produce an instance of that.

Since:
MMBase-1.9.2
Version:
$Id: NodeFunction.java 38475 2009-09-07 14:10:55Z michiel $
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
autoReturnType, name, returnType
 
Constructor Summary
MMObjectNodeFunction(String name, Parameter... def)
           
MMObjectNodeFunction(String name, Parameter<?>[] def, ReturnType<R> returnType)
           
 
Method Summary
protected  MMObjectNode getCoreNode(MMObjectBuilder builder, Node node)
          Utility method to convert a Node to a MMObjectNode.
protected  R getFunctionValue(MMObjectNode coreNode, Parameters parameters)
          Implements the function on a certain node.
protected static Node getNode(MMObjectNode coreNode, Parameters parameters)
           
 Function<R> newInstance(MMObjectNode node)
          Returns a new instance of NodeInstanceFunction, which represents an actual Function.
static
<Q> Function<Q>
newInstance(NodeFunction<Q> function, MMObjectNode node)
           
 
Methods inherited from class org.mmbase.util.functions.NodeFunction
getFunctionNameAndFillArgs, getFunctionValue, getFunctionValue, getFunctionValue, getFunctionValueForNode, getNode, getNodeParameterDef, getReturnType, newInstance, wrap
 
Methods inherited from class org.mmbase.util.functions.AbstractFunction
compareTo, createParameters, equals, getDescription, getFunctionValueWithArgs, getFunctionValueWithList, getName, getParameterDefinition, hashCode, setDescription, setParameterDefinition, setReturnType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MMObjectNodeFunction

public MMObjectNodeFunction(String name,
                            Parameter<?>[] def,
                            ReturnType<R> returnType)

MMObjectNodeFunction

public MMObjectNodeFunction(String name,
                            Parameter... def)
Since:
MMBase-1.9
Method Detail

newInstance

public static <Q> Function<Q> newInstance(NodeFunction<Q> function,
                                          MMObjectNode node)

newInstance

public final Function<R> newInstance(MMObjectNode node)
Returns a new instance of NodeInstanceFunction, which represents an actual Function.


getNode

protected static Node getNode(MMObjectNode coreNode,
                              Parameters parameters)

getFunctionValue

protected final R getFunctionValue(MMObjectNode coreNode,
                                   Parameters parameters)
Implements the function on a certain node. Override this method or it's bridge counter-part NodeFunction.getFunctionValue(org.mmbase.bridge.Node, Parameters). Overriding the bridge version has two advantages. It's easier, and mmbase security will be honoured. That last thing is of course not necesary if you are not going to use other nodes. XXX: made final because it does not work well if you don't implement a bridge version


getCoreNode

protected final MMObjectNode getCoreNode(MMObjectBuilder builder,
                                         Node node)
Utility method to convert a Node to a MMObjectNode.



MMBase2 Core 2.0-SNAPSHOT - 2014-09-22T23:08