Top Description Fields Constructors Methods
org.springframework.expression.spel.ast

public Class OpPlus

extends Operator
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, org.springframework.asm.MethodVisitor, org.springframework.core.convert.TypeDescriptor, org.springframework.expression.EvaluationException, .Operation, .TypeConverter, .TypedValue, org.springframework.expression.spel.CodeFlow, .ExpressionState, .SpelEvaluationException, .SpelMessage, org.springframework.lang.Nullable, org.springframework.util.Assert, .NumberUtils

The plus operator will:

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.

Authors
Andy Clement, Juergen Hoeller, Ivo Smid, Giovanni Dall'Oglio Risso, Sam Brannen
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final int
MAX_CONCATENATED_STRING_LENGTH

Maximum number of characters permitted in a concatenated string.

Inherited from org.springframework.expression.spel.ast.Operator:
leftActualDescriptorrightActualDescriptor

Constructor Summary

AccessConstructor and Description
public
OpPlus(int startPos, int endPos, SpelNodeImpl... operands)

Method Summary

Modifier and TypeMethod and Description
private void
private TypedValue
concatenate(String leftString, String rightString)

private static String

Returns:

TypedValue instance converted to String
convertTypedValueToString
(TypedValue
typed value to be converted
value
,
ExpressionState
expression state
state
)

Convert operand value to string using registered converter or using toString method.

public void
generateCode(MethodVisitor
the ASM MethodVisitor into which code should be generated
mv
,
CodeFlow
a context object with info about what is on the stack
cf
)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

Generate the bytecode for this node into the supplied visitor.
public SpelNodeImpl
public TypedValue
public boolean
isCompilable()

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

Check whether a node can be compiled to bytecode.
public String
toStringAST()

Overrides org.springframework.expression.spel.ast.Operator.toStringAST.

Implements org.springframework.expression.spel.SpelNode.toStringAST.

String format for all operators is the same '(' [operand] [operator] [operand] ')'.
private void
walk(MethodVisitor mv, CodeFlow cf, SpelNodeImpl operand)

Walk through a possible tree of nodes that combine strings and append them all to the same (on stack) StringBuilder.

Inherited from org.springframework.expression.spel.ast.Operator:
equalityCheckgenerateComparisonCodegetLeftOperandgetOperatorNameisCompilableOperatorUsingNumerics

Field Detail

MAX_CONCATENATED_STRING_LENGTHback to summary
private static final int MAX_CONCATENATED_STRING_LENGTH

Maximum number of characters permitted in a concatenated string.

Since
5.2.24

Constructor Detail

OpPlusback to summary
public OpPlus(int startPos, int endPos, SpelNodeImpl... operands)

Method Detail

checkStringLengthback to summary
private void checkStringLength(String string)
concatenateback to summary
private TypedValue concatenate(String leftString, String rightString)
convertTypedValueToStringback to summary
private static String convertTypedValueToString(TypedValue value, ExpressionState state)

Convert operand value to string using registered converter or using toString method.

Parameters
value:TypedValue

typed value to be converted

state:ExpressionState

expression state

Returns:String

TypedValue instance converted to String

generateCodeback to summary
public void generateCode(MethodVisitor mv, CodeFlow cf)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

Doc from org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

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.

Parameters
mv:MethodVisitor

the ASM MethodVisitor into which code should be generated

cf:CodeFlow

a context object with info about what is on the stack

Annotations
@Override
getRightOperandback to summary
public SpelNodeImpl getRightOperand()

Overrides org.springframework.expression.spel.ast.Operator.getRightOperand.

Annotations
@Override
getValueInternalback to summary
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException

Implements abstract org.springframework.expression.spel.ast.SpelNodeImpl.getValueInternal.

Annotations
@Override
isCompilableback to summary
public boolean isCompilable()

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

Doc from org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

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.

Returns:boolean

true if this node can be compiled to bytecode

Annotations
@Override
toStringASTback to summary
public String toStringAST()

Overrides org.springframework.expression.spel.ast.Operator.toStringAST.

Implements org.springframework.expression.spel.SpelNode.toStringAST.

Doc from org.springframework.expression.spel.ast.Operator.toStringAST.

String format for all operators is the same '(' [operand] [operator] [operand] ')'.

Returns:String

Doc from org.springframework.expression.spel.SpelNode.toStringAST.

the string form

Annotations
@Override
walkback to summary
private void walk(MethodVisitor mv, CodeFlow cf, SpelNodeImpl operand)

Walk through a possible tree of nodes that combine strings and append them all to the same (on stack) StringBuilder.