org.springframework.expression.spel.ast
Class FunctionReference

java.lang.Object
  extended by org.springframework.expression.spel.ast.SpelNodeImpl
      extended by org.springframework.expression.spel.ast.FunctionReference
All Implemented Interfaces:
SpelNode

public class FunctionReference
extends SpelNodeImpl

A function reference is of the form "#someFunction(a,b,c)". Functions may be defined in the context prior to the expression being evaluated or within the expression itself using a lambda function definition. For example: Lambda function definition in an expression: "(#max = {|x,y|$x>$y?$x:$y};max(2,3))" Calling context defined function: "#isEven(37)". Functions may also be static java methods, registered in the context prior to invocation of the expression.

Functions are very simplistic, the arguments are not part of the definition (right now), so the names must be unique.

Since:
3.0
Author:
Andy Clement

Field Summary
 
Fields inherited from class org.springframework.expression.spel.ast.SpelNodeImpl
children, pos
 
Constructor Summary
FunctionReference(String functionName, int pos, SpelNodeImpl... arguments)
           
 
Method Summary
 TypedValue getValueInternal(ExpressionState state)
           
 String toStringAST()
           
 
Methods inherited from class org.springframework.expression.spel.ast.SpelNodeImpl
getChild, getChildCount, getEndPosition, getObjectClass, getPreviousChild, getStartPosition, getTypedValue, getValue, getValue, isWritable, nextChildIs, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionReference

public FunctionReference(String functionName,
                         int pos,
                         SpelNodeImpl... arguments)
Method Detail

getValueInternal

public TypedValue getValueInternal(ExpressionState state)
                            throws EvaluationException
Specified by:
getValueInternal in class SpelNodeImpl
Throws:
EvaluationException

toStringAST

public String toStringAST()
Specified by:
toStringAST in interface SpelNode
Specified by:
toStringAST in class SpelNodeImpl
Returns:
the string form of this AST node