类 FunctionReference

java.lang.Object
cn.taketoday.expression.spel.ast.SpelNodeImpl
cn.taketoday.expression.spel.ast.FunctionReference
所有已实现的接口:
Opcodes, 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. 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.

从以下版本开始:
4.0
作者:
Andy Clement, Juergen Hoeller, Harry Yang
  • 字段详细资料

  • 构造器详细资料

    • FunctionReference

      public FunctionReference(String functionName, int startPos, int endPos, SpelNodeImpl... arguments)
  • 方法详细资料

    • getValueInternal

      public TypedValue getValueInternal(ExpressionState state) throws EvaluationException
      指定者:
      getValueInternal 在类中 SpelNodeImpl
      抛出:
      EvaluationException
    • executeFunctionViaMethod

      private TypedValue executeFunctionViaMethod(ExpressionState state, Method method) throws EvaluationException
      Execute a function represented as a Method.
      参数:
      state - the expression evaluation state
      method - the method to invoke
      返回:
      the return value of the invoked Java method
      抛出:
      EvaluationException - if there is any problem invoking the method
    • executeFunctionViaMethodHandle

      private TypedValue executeFunctionViaMethodHandle(ExpressionState state, MethodHandle methodHandle) throws EvaluationException
      Execute a function represented as MethodHandle.

      Method types that take no arguments (fully bound handles or static methods with no parameters) can use MethodHandle#invoke() which is the most efficient. Otherwise, MethodHandle#invokeWithArguments() is used.

      参数:
      state - the expression evaluation state
      methodHandle - the method handle to invoke
      返回:
      the return value of the invoked Java method
      抛出:
      EvaluationException - if there is any problem invoking the method
    • toStringAST

      public String toStringAST()
      从接口复制的说明: SpelNode
      Return the string form the this AST node.
      返回:
      the string form
    • getArguments

      private Object[] getArguments(ExpressionState state) throws EvaluationException
      Compute the arguments to the function, they are the children of this expression node.
      返回:
      an array of argument values for the function call
      抛出:
      EvaluationException
    • isCompilable

      public boolean isCompilable()
      从类复制的说明: SpelNodeImpl
      Check whether a node can be compiled to bytecode. The reasoning in each node may be different but will typically involve checking whether the exit type descriptor of the node is known and any relevant child nodes are compilable.
      覆盖:
      isCompilable 在类中 SpelNodeImpl
      返回:
      true if this node can be compiled to bytecode
    • generateCode

      public void generateCode(MethodVisitor mv, CodeFlow cf)
      从类复制的说明: SpelNodeImpl
      Generate the bytecode for this node into the supplied visitor. Context info about the current expression being compiled is available in the codeflow object, e.g. including information about the type of the object currently on the stack.
      覆盖:
      generateCode 在类中 SpelNodeImpl
      参数:
      mv - the ASM MethodVisitor into which code should be generated
      cf - a context object with info about what is on the stack