org.springframework.expression.spel.ast

## Class Literal

- java.lang.Object
- - org.springframework.expression.spel.ast.SpelNodeImpl
  - - org.springframework.expression.spel.ast.Literal

- All Implemented Interfaces:
    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

- - ### Field Summary

    - ### Fields inherited from class org.springframework.expression.spel.ast.SpelNodeImpl

      `children, pos`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Literal(String originalValue, int pos)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Literal` | `getIntLiteral(String numberToken, int pos, int radix)` Process the string form of a number, using the specified base if supplied and return an appropriate literal to hold it.
    `abstract TypedValue` | `getLiteralValue()`
    `static Literal` | `getLongLiteral(String numberToken, int pos, int radix)`
    `String` | `getOriginalValue()`
    `static Literal` | `getRealLiteral(String numberToken, int pos, boolean isFloat)`
    `TypedValue` | `getValueInternal(ExpressionState state)`
    `String` | `toString()`
    `String` | `toStringAST()`

    - ### Methods inherited from class org.springframework.expression.spel.ast.SpelNodeImpl

      `getChild, getChildCount, getEndPosition, getObjectClass, getPreviousChild, getStartPosition, getTypedValue, getValue, getValue, getValueRef, isWritable, nextChildIs, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Literal

          public Literal(String originalValue,
                 int pos)

  - ### Method Detail

    - #### getOriginalValue

          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()

      Specified by:
        `toStringAST` in interface `SpelNode`
      Specified by:
        `toStringAST` in class `SpelNodeImpl`
      Returns:
        the string form of this AST node

    - #### getLiteralValue

          public abstract TypedValue getLiteralValue()

    - #### getIntLiteral

          public static Literal getIntLiteral(String numberToken,
                              int pos,
                              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 pos,
                               int radix)

    - #### getRealLiteral

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