public abstract class Value extends VersionedValue<Value> implements HasSQL, Typed
| Modifier and Type | Field and Description |
|---|---|
static int |
ARRAY
The value type for ARRAY values.
|
static int |
BIGINT
The value type for BIGINT values.
|
static int |
BINARY
The value type for BINARY values.
|
static int |
BLOB
The value type for BINARY LARGE OBJECT values.
|
static int |
BOOLEAN
The value type for BOOLEAN values.
|
static int |
CHAR
The value type for CHARACTER values.
|
static int |
CLOB
The value type for CHARACTER LARGE OBJECT values.
|
static int |
DATE
The value type for DATE values.
|
static int |
DECFLOAT
The value type for DECFLOAT values.
|
static int |
DOUBLE
The value type for DOUBLE PRECISION values.
|
static Value[] |
EMPTY_VALUES
Empty array of values.
|
static int |
ENUM
The value type for ENUM values.
|
static int |
GEOMETRY
The value type for string values with a fixed size.
|
static int |
INTEGER
The value type for INTEGER values.
|
static int |
INTERVAL_DAY
The value type for
INTERVAL DAY values. |
static int |
INTERVAL_DAY_TO_HOUR
The value type for
INTERVAL DAY TO HOUR values. |
static int |
INTERVAL_DAY_TO_MINUTE
The value type for
INTERVAL DAY TO MINUTE values. |
static int |
INTERVAL_DAY_TO_SECOND
The value type for
INTERVAL DAY TO SECOND values. |
static int |
INTERVAL_HOUR
The value type for
INTERVAL HOUR values. |
static int |
INTERVAL_HOUR_TO_MINUTE
The value type for
INTERVAL HOUR TO MINUTE values. |
static int |
INTERVAL_HOUR_TO_SECOND
The value type for
INTERVAL HOUR TO SECOND values. |
static int |
INTERVAL_MINUTE
The value type for
INTERVAL MINUTE values. |
static int |
INTERVAL_MINUTE_TO_SECOND
The value type for
INTERVAL MINUTE TO SECOND values. |
static int |
INTERVAL_MONTH
The value type for
INTERVAL MONTH values. |
static int |
INTERVAL_SECOND
The value type for
INTERVAL SECOND values. |
static int |
INTERVAL_YEAR
The value type for
INTERVAL YEAR values. |
static int |
INTERVAL_YEAR_TO_MONTH
The value type for
INTERVAL YEAR TO MONTH values. |
static int |
JAVA_OBJECT
The value type for JAVA_OBJECT values.
|
static int |
JSON
The value type for JSON values.
|
static java.math.BigDecimal |
MIN_LONG_DECIMAL
The smallest Long value, as a BigDecimal.
|
static int |
NULL
The value type for NULL.
|
static int |
NUMERIC
The value type for NUMERIC values.
|
static int |
REAL
The value type for REAL values.
|
static int |
ROW
The value type for ROW values.
|
static int |
SMALLINT
The value type for SMALLINT values.
|
static int |
TIME
The value type for TIME values.
|
static int |
TIME_TZ
The value type for TIME WITH TIME ZONE values.
|
static int |
TIMESTAMP
The value type for TIMESTAMP values.
|
static int |
TIMESTAMP_TZ
The value type for TIMESTAMP WITH TIME ZONE values.
|
static int |
TINYINT
The value type for TINYINT values.
|
static int |
TYPE_COUNT
The number of value types.
|
static int |
UNKNOWN
The data type is unknown at this time.
|
static int |
UUID
The value type for UUID values.
|
static int |
VARBINARY
The value type for BINARY VARYING values.
|
static int |
VARCHAR
The value type for CHARACTER VARYING values.
|
static int |
VARCHAR_IGNORECASE
The value type for VARCHAR_IGNORECASE values.
|
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Constructor and Description |
|---|
Value() |
| Modifier and Type | Method and Description |
|---|---|
Value |
add(Value v)
Add a value and return the result.
|
Value |
castTo(TypeInfo targetType,
CastDataProvider provider)
Cast a value to the specified type.
|
long |
charLength()
Returns length of this value in characters.
|
static void |
clearCache()
Clear the value cache.
|
int |
compareTo(Value v,
CastDataProvider provider,
CompareMode compareMode)
Compare this value against another value using the specified compare
mode.
|
abstract int |
compareTypeSafe(Value v,
CompareMode mode,
CastDataProvider provider)
Compare this value against another value given that the values are of the
same data type.
|
int |
compareWithNull(Value v,
boolean forEquality,
CastDataProvider provider,
CompareMode compareMode)
Compare this value against another value using the specified compare
mode.
|
boolean |
containsNull()
Returns true if this value is NULL or contains NULL value.
|
Value |
convertForAssignTo(TypeInfo targetType,
CastDataProvider provider,
java.lang.Object column)
Cast a value to the specified type for assignment.
|
Value |
convertTo(int targetType)
Convert a value to the specified type without taking scale and precision
into account.
|
Value |
convertTo(int targetType,
CastDataProvider provider)
Convert a value to the specified type without taking scale and precision
into account.
|
Value |
convertTo(TypeInfo targetType)
Convert a value to the specified type without taking scale and precision
into account.
|
Value |
convertTo(TypeInfo targetType,
CastDataProvider provider)
Convert a value to the specified type without taking scale and precision
into account.
|
Value |
convertTo(TypeInfo targetType,
CastDataProvider provider,
java.lang.Object column)
Convert a value to the specified type without taking scale and precision
into account.
|
ValueArray |
convertToAnyArray(CastDataProvider provider)
Convert this value to any ARRAY data type.
|
ValueJson |
convertToAnyJson()
Convert this value to JSON data type.
|
ValueRow |
convertToAnyRow()
Convert this value to any ROW data type.
|
ValueBigint |
convertToBigint(java.lang.Object column)
Converts this value to a BIGINT value.
|
ValueBoolean |
convertToBoolean()
Converts this value to a BOOLEAN value.
|
ValueChar |
convertToChar()
Converts this value to a CHAR value.
|
ValueDate |
convertToDate(CastDataProvider provider)
Converts this value to a DATE value.
|
ValueDouble |
convertToDouble()
Converts this value to a DOUBLE value.
|
ValueEnum |
convertToEnum(ExtTypeInfoEnum extTypeInfo,
CastDataProvider provider)
Converts this value to an ENUM value.
|
ValueGeometry |
convertToGeometry(ExtTypeInfoGeometry extTypeInfo)
Converts this value to a GEOMETRY value.
|
static int |
convertToInt(long x,
java.lang.Object column)
Convert to integer, throwing exception if out of range.
|
ValueInteger |
convertToInt(java.lang.Object column)
Converts this value to a INT value.
|
ValueJavaObject |
convertToJavaObject(TypeInfo targetType,
int conversionMode,
java.lang.Object column)
Converts this value to a JAVA_OBJECT value.
|
ValueReal |
convertToReal()
Converts this value to a REAL value.
|
ValueSmallint |
convertToSmallint(java.lang.Object column)
Converts this value to a SMALLINT value.
|
ValueTinyint |
convertToTinyint(java.lang.Object column)
Converts this value to a TINYINT value.
|
ValueUuid |
convertToUuid()
Converts this value to a UUID value.
|
Value |
divide(Value v,
TypeInfo quotientType)
Divide by a value and return the result.
|
abstract boolean |
equals(java.lang.Object other)
Check if the two values have the same hash code.
|
java.math.BigDecimal |
getBigDecimal() |
boolean |
getBoolean()
Returns this value as a Java
boolean value. |
byte |
getByte()
Returns this value as a Java
byte value. |
byte[] |
getBytes() |
byte[] |
getBytesNoCopy() |
double |
getDouble()
Returns this value as a Java
double value. |
float |
getFloat()
Returns this value as a Java
float value. |
static int |
getHigherOrder(int t1,
int t2)
Get the higher value order type of two value types.
|
java.io.InputStream |
getInputStream() |
java.io.InputStream |
getInputStream(long oneBasedOffset,
long length)
Get the input stream
|
int |
getInt()
Returns this value as a Java
int value. |
long |
getLong()
Returns this value as a Java
long value. |
int |
getMemory()
Get the memory used by this object.
|
java.io.Reader |
getReader() |
java.io.Reader |
getReader(long oneBasedOffset,
long length)
Get the reader
|
short |
getShort()
Returns this value as a Java
short value. |
int |
getSignum() |
abstract java.lang.String |
getString()
Get the value as a string.
|
abstract TypeInfo |
getType()
Returns the data type.
|
static java.lang.String |
getTypeName(int valueType)
Returns name of the specified data type.
|
protected DbException |
getUnsupportedExceptionForOperation(java.lang.String op)
Create an exception meaning the specified operation is not supported for
this data type.
|
abstract int |
getValueType()
Get the value type.
|
Value |
getValueWithFirstNull(Value v)
Scans this and specified values until a first NULL occurrence and returns
a value where NULL appears earlier, or
null if these two values
have first NULL on the same position. |
abstract int |
hashCode() |
boolean |
isFalse()
Returns whether this value
IS FALSE. |
boolean |
isTrue()
Returns whether this value
IS TRUE. |
Value |
modulus(Value v)
Take the modulus with a value and return the result.
|
Value |
multiply(Value v)
Multiply with a value and return the result.
|
Value |
negate()
Return -value if this value support arithmetic operations.
|
long |
octetLength()
Returns length of this value in bytes.
|
Value |
subtract(Value v)
Subtract a value and return the result.
|
java.lang.String |
toString() |
getCommittedValue, getCurrentValue, getOperationId, isCommittedclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetSQL, getSQL, getTraceSQLpublic static final int UNKNOWN
public static final int NULL
public static final int CHAR
public static final int VARCHAR
public static final int CLOB
public static final int VARCHAR_IGNORECASE
public static final int BINARY
public static final int VARBINARY
public static final int BLOB
public static final int BOOLEAN
public static final int TINYINT
public static final int SMALLINT
public static final int INTEGER
public static final int BIGINT
public static final int NUMERIC
public static final int REAL
public static final int DOUBLE
public static final int DECFLOAT
public static final int DATE
public static final int TIME
public static final int TIME_TZ
public static final int TIMESTAMP
public static final int TIMESTAMP_TZ
public static final int INTERVAL_YEAR
INTERVAL YEAR values.public static final int INTERVAL_MONTH
INTERVAL MONTH values.public static final int INTERVAL_DAY
INTERVAL DAY values.public static final int INTERVAL_HOUR
INTERVAL HOUR values.public static final int INTERVAL_MINUTE
INTERVAL MINUTE values.public static final int INTERVAL_SECOND
INTERVAL SECOND values.public static final int INTERVAL_YEAR_TO_MONTH
INTERVAL YEAR TO MONTH values.public static final int INTERVAL_DAY_TO_HOUR
INTERVAL DAY TO HOUR values.public static final int INTERVAL_DAY_TO_MINUTE
INTERVAL DAY TO MINUTE values.public static final int INTERVAL_DAY_TO_SECOND
INTERVAL DAY TO SECOND values.public static final int INTERVAL_HOUR_TO_MINUTE
INTERVAL HOUR TO MINUTE values.public static final int INTERVAL_HOUR_TO_SECOND
INTERVAL HOUR TO SECOND values.public static final int INTERVAL_MINUTE_TO_SECOND
INTERVAL MINUTE TO SECOND values.public static final int JAVA_OBJECT
public static final int ENUM
public static final int GEOMETRY
public static final int JSON
public static final int UUID
public static final int ARRAY
public static final int ROW
public static final int TYPE_COUNT
public static final Value[] EMPTY_VALUES
public static final java.math.BigDecimal MIN_LONG_DECIMAL
public static java.lang.String getTypeName(int valueType)
valueType - the value typepublic abstract TypeInfo getType()
Typedpublic abstract int getValueType()
public int getMemory()
public abstract int hashCode()
hashCode in class java.lang.Objectpublic abstract boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - the other valuepublic static int getHigherOrder(int t1,
int t2)
t1 - the first value typet2 - the second value typepublic static void clearCache()
public abstract java.lang.String getString()
public java.io.Reader getReader()
public java.io.Reader getReader(long oneBasedOffset,
long length)
oneBasedOffset - the offset (1 means no offset)length - the requested lengthpublic byte[] getBytes()
public byte[] getBytesNoCopy()
public java.io.InputStream getInputStream()
public java.io.InputStream getInputStream(long oneBasedOffset,
long length)
oneBasedOffset - the offset (1 means no offset)length - the requested lengthpublic boolean getBoolean()
boolean value.DbException - if this value is NULL or cannot be casted to
BOOLEANisTrue(),
isFalse()public byte getByte()
byte value.DbException - if this value is NULL or cannot be casted to
TINYINTpublic short getShort()
short value.DbException - if this value is NULL or cannot be casted to
SMALLINTpublic int getInt()
int value.DbException - if this value is NULL or cannot be casted to
INTEGERpublic long getLong()
long value.DbException - if this value is NULL or cannot be casted to
BIGINTpublic java.math.BigDecimal getBigDecimal()
public float getFloat()
float value.DbException - if this value is NULL or cannot be casted to
REALpublic double getDouble()
double value.DbException - if this value is NULL or cannot be casted to
DOUBLE PRECISIONpublic Value add(Value v)
v - the value to addpublic int getSignum()
public Value negate()
public Value subtract(Value v)
v - the value to subtractpublic Value divide(Value v, TypeInfo quotientType)
v - the divisorquotientType - the type of quotient (used only to read precision and scale
when applicable)public Value multiply(Value v)
v - the value to multiply withpublic Value modulus(Value v)
v - the value to take the modulus withpublic final Value convertTo(int targetType)
targetType - the type of the returned valuepublic final Value convertTo(TypeInfo targetType)
targetType - the type of the returned valuepublic final Value convertTo(int targetType, CastDataProvider provider)
targetType - the type of the returned valueprovider - the cast information providerpublic final Value convertTo(TypeInfo targetType, CastDataProvider provider)
targetType - the type of the returned valueprovider - the cast information providerpublic final Value convertTo(TypeInfo targetType, CastDataProvider provider, java.lang.Object column)
targetType - the type of the returned valueprovider - the cast information providercolumn - the column, used to improve the error message if conversion
failspublic final ValueJson convertToAnyJson()
public final ValueArray convertToAnyArray(CastDataProvider provider)
provider - the cast information providerpublic final ValueRow convertToAnyRow()
public final Value castTo(TypeInfo targetType, CastDataProvider provider)
targetType - the type of the returned valueprovider - the cast information providerpublic final Value convertForAssignTo(TypeInfo targetType, CastDataProvider provider, java.lang.Object column)
targetType - the type of the returned valueprovider - the cast information providercolumn - the column, used to improve the error message if conversion
failspublic ValueChar convertToChar()
public final ValueBoolean convertToBoolean()
public final ValueTinyint convertToTinyint(java.lang.Object column)
column - the column, used for to improve the error message if
conversion failspublic final ValueSmallint convertToSmallint(java.lang.Object column)
column - the column, used for to improve the error message if
conversion failspublic final ValueInteger convertToInt(java.lang.Object column)
column - the column, used for to improve the error message if
conversion failspublic final ValueBigint convertToBigint(java.lang.Object column)
column - the column, used for to improve the error message if
conversion failspublic final ValueReal convertToReal()
public final ValueDouble convertToDouble()
public final ValueDate convertToDate(CastDataProvider provider)
provider - the cast information providerpublic final ValueJavaObject convertToJavaObject(TypeInfo targetType, int conversionMode, java.lang.Object column)
targetType - the type of the returned valueconversionMode - conversion modecolumn - the column (if any), used to improve the error message if
conversion failspublic final ValueEnum convertToEnum(ExtTypeInfoEnum extTypeInfo, CastDataProvider provider)
extTypeInfo - the extended data type informationprovider - the cast information providerpublic final ValueGeometry convertToGeometry(ExtTypeInfoGeometry extTypeInfo)
extTypeInfo - the extended data type information, or nullpublic final ValueUuid convertToUuid()
public abstract int compareTypeSafe(Value v, CompareMode mode, CastDataProvider provider)
v - the other valuemode - the compare modeprovider - the cast information providerpublic final int compareTo(Value v, CastDataProvider provider, CompareMode compareMode)
v - the other valueprovider - the cast information providercompareMode - the compare modepublic int compareWithNull(Value v, boolean forEquality, CastDataProvider provider, CompareMode compareMode)
v - the other valueforEquality - perform only check for equalityprovider - the cast information providercompareMode - the compare modeInteger.MIN_VALUE if order is
not defined due to NULL comparisonpublic boolean containsNull()
public Value getValueWithFirstNull(Value v)
null if these two values
have first NULL on the same position.v - a value of the same data type as this value, must be neither
equal to nor smaller than nor greater than this valuenullpublic static int convertToInt(long x,
java.lang.Object column)
x - integer value.column - Column info.public java.lang.String toString()
toString in class java.lang.Objectprotected final DbException getUnsupportedExceptionForOperation(java.lang.String op)
op - the operationpublic long charLength()
java.lang.NullPointerException - if this value is NULLpublic long octetLength()
java.lang.NullPointerException - if this value is NULLpublic final boolean isTrue()
IS TRUE.true if it is. For BOOLEAN values returns
true for TRUE and false for FALSE
and UNKNOWN (NULL).getBoolean(),
isFalse()public final boolean isFalse()
IS FALSE.true if it is. For BOOLEAN values returns
true for FALSE and false for TRUE
and UNKNOWN (NULL).getBoolean(),
isTrue()