spring-framework / org.springframework.expression.spel.ast

Package org.springframework.expression.spel.ast

Types

Assign

open class Assign : SpelNodeImpl

Represents assignment. An alternative to calling setValue() for an expression is to use an assign.

Example: 'someNumberProperty=42'

AstUtils

abstract class AstUtils

Utilities methods for use in the Ast classes.

BeanReference

open class BeanReference : SpelNodeImpl

Represents a bean reference to a type, for example @foo or @'foo.bar'. For a FactoryBean the syntax &foo can be used to access the factory itself.

BooleanLiteral

open class BooleanLiteral : Literal

Represents the literal values TRUE and FALSE.

CompoundExpression

open class CompoundExpression : SpelNodeImpl

Represents a DOT separated expression sequence, such as 'property1.property2.methodOne()'

ConstructorReference

open class ConstructorReference : SpelNodeImpl

Represents the invocation of a constructor. Either a constructor on a regular type or construction of an array. When an array is constructed, an initializer can be specified.

Examples: new String('hello world') new int[]{1,2,3,4} new int[3] new int[3]{1,2,3}

Elvis

open class Elvis : SpelNodeImpl

Represents the elvis operator ?:. For an expression "a?:b" if a is not null, the value of the expression is "a", if a is null then the value of the expression is "b".

FloatLiteral

open class FloatLiteral : Literal

Expression language AST node that represents a float literal.

FormatHelper

open class FormatHelper

Utility methods (formatters, etc) used during parsing and evaluation.

FunctionReference

open class FunctionReference : 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 or within the expression itself using a lambda function definition. For example: Lambda function definition in an expression: "(#max = {|x,y|$x>$y?$x:$y};max(2,3))" Calling context defined function: "#isEven(37)". 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.

Identifier

open class Identifier : SpelNodeImpl

Indexer

open class Indexer : SpelNodeImpl

An Indexer can index into some proceeding structure to access a particular piece of it. Supported structures are: strings / collections (lists/sets) / arrays.

InlineList

open class InlineList : SpelNodeImpl

Represent a list in an expression, e.g. '{1,2,3}'

InlineMap

open class InlineMap : SpelNodeImpl

Represent a map in an expression, e.g. '{name:'foo',age:12}'

IntLiteral

open class IntLiteral : Literal

Expression language AST node that represents an integer literal.

Literal

abstract class Literal : SpelNodeImpl

Common superclass for nodes representing literals (boolean, string, number, etc).

LongLiteral

open class LongLiteral : Literal

Expression language AST node that represents a long integer literal.

MethodReference

open class MethodReference : SpelNodeImpl

Expression language AST node that represents a method reference.

NullLiteral

open class NullLiteral : Literal

Expression language AST node that represents null.

OpAnd

open class OpAnd : Operator

Represents the boolean AND operation.

OpDec

open class OpDec : Operator

Decrement operator. Can be used in a prefix or postfix form. This will throw appropriate exceptions if the operand in question does not support decrement.

OpDivide

open class OpDivide : Operator

Implements division operator.

OpEQ

open class OpEQ : Operator

Implements the equality operator.

OpGE

open class OpGE : Operator

Implements greater-than-or-equal operator.

OpGT

open class OpGT : Operator

Implements the greater-than operator.

OpInc

open class OpInc : Operator

Increment operator. Can be used in a prefix or postfix form. This will throw appropriate exceptions if the operand in question does not support increment.

OpLE

open class OpLE : Operator

Implements the less-than-or-equal operator.

OpLT

open class OpLT : Operator

Implements the less-than operator.

OpMinus

open class OpMinus : Operator

The minus operator supports:

  • subtraction of numbers
  • subtraction of an int from a string of one character (effectively decreasing that character), so 'd'-3='a'

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.

OpModulus

open class OpModulus : Operator

Implements the modulus operator.

OpMultiply

open class OpMultiply : Operator

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.

OpNE

open class OpNE : Operator

Implements the not-equal operator.

OpOr

open class OpOr : Operator

Represents the boolean OR operation.

OpPlus

open class OpPlus : 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.

OperatorBetween

open class OperatorBetween : Operator

Represents the between operator. The left operand to between must be a single value and the right operand must be a list - this operator returns true if the left operand is between (using the registered comparator) the two elements in the list. The definition of between being inclusive follows the SQL BETWEEN definition.

OperatorInstanceof

open class OperatorInstanceof : Operator

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.

OperatorMatches

open class OperatorMatches : Operator

Implements the matches operator. Matches takes two operands: The first is a String and the second is a Java regex. It will return true when #getValue is called if the first operand matches the regex.

OperatorNot

open class OperatorNot : SpelNodeImpl

Represents a NOT operation.

OperatorPower

open class OperatorPower : Operator

The power operator.

Projection

open class Projection : SpelNodeImpl

Represents projection, where a given operation is performed on all elements in some input sequence, returning a new sequence of the same size. For example: "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]"

PropertyOrFieldReference

open class PropertyOrFieldReference : SpelNodeImpl

Represents a simple property or field reference.

QualifiedIdentifier

open class QualifiedIdentifier : SpelNodeImpl

Represents a dot separated sequence of strings that indicate a package qualified type reference.

Example: "java.lang.String" as in the expression "new java.lang.String('hello')"

RealLiteral

open class RealLiteral : Literal

Expression language AST node that represents a real literal.

Selection

open class Selection : SpelNodeImpl

Represents selection over a map or collection. For example: {1,2,3,4,5,6,7,8,9,10}.?{#isEven(#this) == 'y'} returns [2, 4, 6, 8, 10]

Basically a subset of the input data is returned based on the evaluation of the expression supplied as selection criteria.

StringLiteral

open class StringLiteral : Literal

Expression language AST node that represents a string literal.

Ternary

open class Ternary : SpelNodeImpl

Represents a ternary expression, for example: "someCheck()?true:false".

TypeCode

class TypeCode

Captures primitive types and their corresponding class objects, plus one special entry that represents all reference (non-primitive) types.

TypeReference

open class TypeReference : SpelNodeImpl

Represents a reference to a type, for example "T(String)" or "T(com.somewhere.Foo)"

VariableReference

open class VariableReference : SpelNodeImpl

Represents a variable reference, eg. #someVar. Note this is different to a *local* variable like $someVar