Interface CtLiteral<T>

Type Parameters:
T - type of literal's value
All Superinterfaces:
Cloneable, CtCodeElement, CtElement, CtExpression<T>, CtQueryable, CtTypedElement<T>, CtVisitable, FactoryAccessor, Serializable, SourcePositionHolder, TemplateParameter<T>
All Known Subinterfaces:
All Known Implementing Classes:
CtLiteralImpl, CtTextBlockImpl

public interface CtLiteral<T> extends CtExpression<T>
This code element defines a literal value (an int, a string, etc).
     int x = 4; // 4 is a literal
A null literal, as in s = null", is represented by a CtLiteral whose value is null.
  • Method Details

    • getValue

      T getValue()
      Gets the actual value of the literal (statically known).
    • setValue

      <C extends CtLiteral<T>> C setValue(T value)
      Sets the actual value of the literal.
    • getBase

      LiteralBase getBase()
      Gets the base of the numeric literal (2, 8, 10 or 16).
    • setBase

      <C extends CtLiteral<T>> C setBase(LiteralBase base)
      Sets the base of the numeric literal.
    • clone

      CtLiteral<T> clone()
      Overriding return type, a clone of a CtLiteral returns a CtLiteral
      Specified by:
      clone in interface CtCodeElement
      Specified by:
      clone in interface CtElement
      Specified by:
      clone in interface CtExpression<T>