java.lang.Object
org.springframework.expression.spel.ast.SpelNodeImpl
org.springframework.expression.spel.ast.Literal
All Implemented Interfaces:
Opcodes, SpelNode
Direct Known Subclasses:
BooleanLiteral, FloatLiteral, IntLiteral, LongLiteral, NullLiteral, RealLiteral, StringLiteral

public abstract class Literal extends SpelNodeImpl
Common superclass for nodes representing literals (boolean, string, number, etc).
Author:
Andy Clement, Juergen Hoeller
  • Constructor Details

    • Literal

      public Literal(@Nullable String originalValue, int startPos, int endPos)
  • Method Details

    • getOriginalValue

      @Nullable public final String getOriginalValue()
    • getValueInternal

      public final TypedValue getValueInternal(ExpressionState state) throws SpelEvaluationException
      Specified by:
      getValueInternal in class SpelNodeImpl
      Throws:
      SpelEvaluationException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringAST

      public String toStringAST()
      Description copied from interface: SpelNode
      Return the string form the this AST node.
      Returns:
      the string form
    • getLiteralValue

      public abstract TypedValue getLiteralValue()
    • getIntLiteral

      public static Literal getIntLiteral(String numberToken, int startPos, int endPos, int radix)
      Process the string form of a number, using the specified base if supplied and return an appropriate literal to hold it. Any suffix to indicate a long will be taken into account (either 'l' or 'L' is supported).
      Parameters:
      numberToken - the token holding the number as its payload (eg. 1234 or 0xCAFE)
      radix - the base of number
      Returns:
      a subtype of Literal that can represent it
    • getLongLiteral

      public static Literal getLongLiteral(String numberToken, int startPos, int endPos, int radix)
    • getRealLiteral

      public static Literal getRealLiteral(String numberToken, int startPos, int endPos, boolean isFloat)