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

public Class OpMultiply

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

Implements the multiply operator.

Conversions and promotions are handled as defined in Section 5.6.2 of the Java Language Specification, with the addiction of BigDecimal/BigInteger management:

If any of the operands is of a reference type, unboxing conversion (Section 5.1.8) is performed. Then:
If either operand is of type BigDecimal, the other is converted to BigDecimal.
If either operand is of type double, the other is converted to double.
Otherwise, if either operand is of type float, the other is converted to float.
If either operand is of type BigInteger, the other is converted to BigInteger.
Otherwise, if either operand is of type long, the other is converted to long.
Otherwise, both operands are converted to type int.

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

Field Summary

Modifier and TypeField and Description
private static final int
MAX_REPEATED_TEXT_SIZE

Maximum number of characters permitted in repeated text.

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

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
private void
checkRepeatedTextSize(String text, int count)

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 TypedValue
getValueInternal(ExpressionState state)

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

Implements the multiply operator directly here for certain types of supported operands and otherwise delegates to any registered overloader for types not supported here.

public boolean
isCompilable()

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

Check whether a node can be compiled to bytecode.

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

Field Detail

MAX_REPEATED_TEXT_SIZEback to summary
private static final int MAX_REPEATED_TEXT_SIZE

Maximum number of characters permitted in repeated text.

Since
5.2.23

Constructor Detail

OpMultiplyback to summary
public OpMultiply(int startPos, int endPos, SpelNodeImpl... operands)

Method Detail

checkRepeatedTextSizeback to summary
private void checkRepeatedTextSize(String text, int count)
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
getValueInternalback to summary
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException

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

Implements the multiply operator directly here for certain types of supported operands and otherwise delegates to any registered overloader for types not supported here.

Supported operand types:

  • numbers
  • String and int ('abc' * 2 == 'abcabc')
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