is a constant. It is, appropriately, immutable.
How is the value stored? In that respect, the class is somewhat of a black box. There is a {@link #getValue} method which returns the value as anobject, but the type of that value is implementation detail, and it is best that your code does not depend upon that knowledge. It is better to use task-oriented methods such as {@link #toSqlString(SqlDialect)} and{@link #toValue}.
If you really need to access the value directly, you should switch on the value of the {@link #typeName} field, rather than making assumptions aboutthe runtime type of the {@link #value}.
Allowable types for SqlLiteral TypeName | Meaing | Value type |
{@link SqlTypeName#NULL} | The null value. It has its own special type. | null |
{@link SqlTypeName#BOOLEAN} | Boolean, namely TRUE , FALSE or UNKNOWN . | {@link Boolean}, or null represents the UNKNOWN value |
{@link SqlTypeName#DECIMAL} | Exact number, for example 0 , -.5 , 12345 . | {@link BigDecimal} |
{@link SqlTypeName#DOUBLE} | Approximate number, for example 6.023E-23 . | {@link BigDecimal} |
{@link SqlTypeName#DATE} | Date, for example DATE '1969-04'29' | {@link Calendar} |
{@link SqlTypeName#TIME} | Time, for example TIME '18:37:42.567' | {@link Calendar} |
{@link SqlTypeName#TIMESTAMP} | Timestamp, for example TIMESTAMP '1969-04-29 18:37:42.567' | {@link Calendar} |
{@link SqlTypeName#CHAR} | Character constant, for example 'Hello, world!' , '' , _N'Bonjour' , _ISO-8859-1'It''s superman!' COLLATE SHIFT_JIS$ja_JP$2 . These are always CHAR, never VARCHAR. | {@link NlsString} |
{@link SqlTypeName#BINARY} | Binary constant, for example X'ABC' , X'7F' . Note that strings with an odd number of hexits will later become values of the BIT datatype, because they have an incomplete number of bytes. But here, they are all binary constants, because that's how they were written. These constants are always BINARY, never VARBINARY. | {@link BitString} |
{@link SqlTypeName#SYMBOL} | A symbol is a special type used to make parsing easier; it is not part of the SQL standard, and is not exposed to end-users. It is used to hold a symbol, such as the LEADING flag in a call to the function TRIM([LEADING|TRAILING|BOTH] chars FROM string) . | A class which implements the {@link SqlSymbol} interface |
{@link SqlTypeName#INTERVAL_DAY_TIME} | Interval, for example INTERVAL '1:34' HOUR . | {@link SqlIntervalLiteral.IntervalValue}. |