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

public Class OperatorInstanceof

extends Operator
Class Inheritance
Imports
org.springframework.asm.MethodVisitor, .Type, org.springframework.expression.EvaluationException, .TypedValue, org.springframework.expression.spel.CodeFlow, .ExpressionState, .SpelEvaluationException, .SpelMessage, org.springframework.expression.spel.support.BooleanTypedValue, org.springframework.lang.Nullable, org.springframework.util.Assert

The operator 'instanceof' checks if an object is of the class specified in the right-hand operand, in the same way that instanceof does in Java.
Author
Andy Clement
Since
3.0

Field Summary

Modifier and TypeField and Description
private Class<?>
Inherited from org.springframework.expression.spel.ast.Operator:
leftActualDescriptorrightActualDescriptor

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
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 BooleanTypedValue

Returns:

true if the left operand is an instanceof of the right operand, otherwise false
getValueInternal
(ExpressionState
the expression state
state
)

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

Compare the left operand to see it is an instance of the type specified as the right operand.

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

typeback to summary
private Class<?> type
Annotations
@Nullable

Constructor Detail

OperatorInstanceofback to summary
public OperatorInstanceof(int startPos, int endPos, SpelNodeImpl... operands)

Method Detail

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 BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException

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

Compare the left operand to see it is an instance of the type specified as the right operand. The right operand must be a class.

Parameters
state:ExpressionState

the expression state

Returns:BooleanTypedValue

true if the left operand is an instanceof of the right operand, otherwise false

Annotations
@Override
Exceptions
EvaluationException:
if there is a problem evaluating the expression
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