public abstract class TType extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static TArrayType |
ARRAY_TYPE
A type that represents an array.
|
static TBinaryType |
BINARY_TYPE
A default binary (SQL BLOB) type of unlimited maximum size.
|
static TBooleanType |
BOOLEAN_TYPE
A default boolean (SQL BIT) type.
|
static TDateType |
DATE_TYPE
A default date (SQL TIMESTAMP) type.
|
static TNullType |
NULL_TYPE
A default NULL type.
|
static TNumericType |
NUMERIC_TYPE
A default numeric (SQL NUMERIC) type of unlimited size and scale.
|
static TQueryPlanType |
QUERY_PLAN_TYPE
A type that represents a query plan (sub-select).
|
static TStringType |
STRING_TYPE
A default string (SQL VARCHAR) type of unlimited maximum size and null
locale.
|
Modifier | Constructor and Description |
---|---|
protected |
TType(int sql_type)
Constructs the type object.
|
Modifier and Type | Method and Description |
---|---|
static String |
asEncodedString(TType type)
Encodes a TType into a string which is a useful way to serialize a TType.
|
static String |
asEncodedString(TType[] types)
Given an array of TType, returns a String that that is the encoded form
of the array and that can be later decoded back into an array of TType.
|
String |
asSQLString()
Returns this TType as a fully parsable declared SQL type.
|
static TType |
binaryType(int sql_type,
int size)
Returns a TBinaryType object.
|
static TType |
booleanType(int sql_type)
Returns a TBooleanType object.
|
abstract int |
calculateApproximateMemoryUse(Object ob)
Calculates the approximate memory usage of an object of this type in
bytes.
|
static Object |
castObjectToTType(Object ob,
TType type)
Casts the given Java object to the given type.
|
abstract boolean |
comparableTypes(TType type)
Returns true if the type of this object is logically comparable to the
type of the given object.
|
abstract int |
compareObs(Object ob1,
Object ob2)
Compares two objects that are logically comparable under this
type.
|
static TType |
dateType(int sql_type)
Returns a TDateType object.
|
static TType |
decodeString(String encoded_str)
Decodes a String that has been encoded with the 'asEncodedString' method
and returns a TType that represented the type.
|
static TType[] |
decodeTypes(String encoded_str)
Decodes a list (or array) of TType objects that was previously encoded
with the 'asEncodedString(Type[])' method.
|
static TType |
fromClass(Class c)
Given a java class, this will return a default TType object that can
encapsulate Java objects of this type.
|
int |
getSQLType()
Returns the SQL type of this.
|
static TType |
getWidestType(TType t1,
TType t2)
Assuming that the two types are numeric types, this will return the
'widest' of the two types.
|
abstract Class |
javaClass()
Returns the Java Class that is used to represent this type of object.
|
static TType |
javaObjectType(String class_name)
Returns a TBinaryType constrained for the given class.
|
static TType |
numericType(int sql_type,
int size,
int scale)
Returns a TNumericType object of the given size and scale.
|
static TType |
stringType(int sql_type,
int size,
String locale,
int strength,
int decomposition)
Returns a TStringType object of the given size and locale information.
|
public static final TBooleanType BOOLEAN_TYPE
public static final TStringType STRING_TYPE
public static final TNumericType NUMERIC_TYPE
public static final TDateType DATE_TYPE
public static final TBinaryType BINARY_TYPE
public static final TNullType NULL_TYPE
public static final TQueryPlanType QUERY_PLAN_TYPE
public static final TArrayType ARRAY_TYPE
public int getSQLType()
public String asSQLString()
public abstract boolean comparableTypes(TType type)
public abstract int compareObs(Object ob1, Object ob2)
public abstract int calculateApproximateMemoryUse(Object ob)
public abstract Class javaClass()
public static String asEncodedString(TType type)
public static String asEncodedString(TType[] types)
public static TType decodeString(String encoded_str)
public static TType[] decodeTypes(String encoded_str)
public static TType javaObjectType(String class_name)
public static TType stringType(int sql_type, int size, String locale, int strength, int decomposition)
public static TType numericType(int sql_type, int size, int scale)
public static TType booleanType(int sql_type)
public static TType dateType(int sql_type)
public static TType binaryType(int sql_type, int size)
public static Object castObjectToTType(Object ob, TType type)
public static TType fromClass(Class c)
Note that using this method is generally not recommended unless you really can't determine more type information than from the Java object itself.
Copyright © 2015. All rights reserved.