类 OpPlus

所有已实现的接口:
Opcodes, SpelNode

public class OpPlus extends Operator
The plus operator will:
  • add numbers
  • concatenate strings

It can be used as a unary operator for numbers. The standard promotions are performed when the operand types vary (double+int=double). For other options it defers to the registered overloader.

从以下版本开始:
4.0
作者:
Andy Clement, Juergen Hoeller, Ivo Smid, Giovanni Dall'Oglio Risso, Harry Yang
  • 字段详细资料

    • MAX_CONCATENATED_STRING_LENGTH

      private static final int MAX_CONCATENATED_STRING_LENGTH
      Maximum number of characters permitted in a concatenated string.
      另请参阅:
  • 构造器详细资料

    • OpPlus

      public OpPlus(int startPos, int endPos, SpelNodeImpl... operands)
  • 方法详细资料

    • getValueInternal

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

      private void checkStringLength(String string)
    • concatenate

      private TypedValue concatenate(String leftString, String rightString)
    • toStringAST

      public String toStringAST()
      从类复制的说明: Operator
      String format for all operators is the same '(' [operand] [operator] [operand] ')'.
      指定者:
      toStringAST 在接口中 SpelNode
      覆盖:
      toStringAST 在类中 Operator
      返回:
      the string form
    • getRightOperand

      public SpelNodeImpl getRightOperand()
      覆盖:
      getRightOperand 在类中 Operator
    • convertTypedValueToString

      private static String convertTypedValueToString(TypedValue value, ExpressionState state)
      Convert operand value to string using registered converter or using toString method.
      参数:
      value - typed value to be converted
      state - expression state
      返回:
      TypedValue instance converted to String
    • 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
    • walk

      private void walk(MethodVisitor mv, CodeFlow cf, @Nullable SpelNodeImpl operand)
      Walk through a possible tree of nodes that combine strings and append them all to the same (on stack) StringBuilder.
    • 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