org.jooq.impl
Class AbstractDataType<T>

java.lang.Object
  extended by org.jooq.impl.AbstractDataType<T>
All Implemented Interfaces:
Serializable, DataType<T>
Direct Known Subclasses:
ASEDataType, CUBRIDDataType, DB2DataType, DerbyDataType, H2DataType, HSQLDBDataType, IngresDataType, MySQLDataType, OracleDataType, PostgresDataType, SQLDataType, SQLiteDataType, SQLServerDataType, SybaseDataType

public abstract class AbstractDataType<T>
extends Object
implements DataType<T>

A common base class for data types.

This also acts as a static data type registry for jOOQ internally.

This type is for JOOQ INTERNAL USE only. Do not reference directly

Author:
Lukas Eder
See Also:
Serialized Form

Constructor Summary
protected AbstractDataType(SQLDialect dialect, SQLDataType<T> sqldatatype, Class<? extends T> type, String typeName)
           
protected AbstractDataType(SQLDialect dialect, SQLDataType<T> sqldatatype, Class<? extends T> type, String typeName, boolean hasPrecisionAndScale)
           
protected AbstractDataType(SQLDialect dialect, SQLDataType<T> sqldatatype, Class<? extends T> type, String typeName, String castTypeName)
           
protected AbstractDataType(SQLDialect dialect, SQLDataType<T> sqlDataType, Class<? extends T> type, String typeName, String castTypeName, boolean hasPrecisionAndScale)
           
 
Method Summary
<A extends ArrayRecord<T>>
DataType<A>
asArrayDataType(Class<A> arrayDataType)
          Retrieve the data type for an Oracle-style ARRAY of this data type
<U> DataType<U>
asConvertedDataType(Converter<? super T,U> converter)
          Retrieve the data type for a given converter
<E extends EnumType>
DataType<E>
asEnumDataType(Class<E> enumDataType)
          Retrieve the data type for a given enum data type
<M extends MasterDataType<T>>
DataType<M>
asMasterDataType(Class<M> masterDataType)
          Retrieve the data type for a given master data type
 T convert(Object object)
          Convert an arbitrary object into <T>
 boolean equals(Object obj)
           
 DataType<T[]> getArrayDataType()
          Retrieve the data type for an ARRAY of this data type
 Class<? extends T[]> getArrayType()
          Retrieve the Java type associated with ARRAYs of this data type
 String getCastTypeName()
          Retrieve the dialect-specific type name associated with this data type used for casting This is useful for some dialects that have specialised type names for cast expressions.
 String getCastTypeName(Configuration configuration)
          Retrieve the dialect-specific type name associated with this data type used for casting This is useful for some dialects that have specialised type names for cast expressions.
 String getCastTypeName(Configuration configuration, int precision, int scale)
          Retrieve the dialect-specific type name associated with this data type used for casting This is useful for some dialects that have specialised type names for cast expressions.
 DataType<T> getDataType(Configuration configuration)
          The dialect-specific data type representing this data type.
protected static
<T> DataType<T>
getDataType(SQLDialect dialect, Class<? extends T> type)
           
protected static DataType<?> getDataType(SQLDialect dialect, String typeName)
           
protected static DataType<Object> getDefaultDataType(SQLDialect dialect, String typeName)
           
 SQLDialect getDialect()
          Retrieve the underlying SQLDialect
 SQLDataType<T> getSQLDataType()
          Get the standard SQL data type of this (dialect-specific) data type if available.
 int getSQLType()
          Get JDBC Types value
 Class<? extends T> getType()
          Retrieve the Java type associated with this data type
 Class<?> getType(int precision, int scale)
          Retrieve a Java type associated with this data type and precision/scale
 String getTypeName()
          Retrieve the dialect-specific type name associated with this data type
 String getTypeName(Configuration configuration)
          Retrieve the dialect-specific type name associated with this data type
 int hashCode()
           
 boolean isArray()
          Whether this data type is an array type.
 boolean isBinary()
          Whether this data type is any binary type.
 boolean isDateTime()
          Whether this data type is any date or time type.
 boolean isInterval()
          Whether this data type is any interval type.
 boolean isNumeric()
          Whether this data type is any numeric data type.
 boolean isString()
          Whether this data type is any character data type.
 boolean isTemporal()
          Whether this data type is any date or time type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDataType

protected AbstractDataType(SQLDialect dialect,
                           SQLDataType<T> sqldatatype,
                           Class<? extends T> type,
                           String typeName)

AbstractDataType

protected AbstractDataType(SQLDialect dialect,
                           SQLDataType<T> sqldatatype,
                           Class<? extends T> type,
                           String typeName,
                           String castTypeName)

AbstractDataType

protected AbstractDataType(SQLDialect dialect,
                           SQLDataType<T> sqldatatype,
                           Class<? extends T> type,
                           String typeName,
                           boolean hasPrecisionAndScale)

AbstractDataType

protected AbstractDataType(SQLDialect dialect,
                           SQLDataType<T> sqlDataType,
                           Class<? extends T> type,
                           String typeName,
                           String castTypeName,
                           boolean hasPrecisionAndScale)
Method Detail

getSQLDataType

public final SQLDataType<T> getSQLDataType()
Description copied from interface: DataType
Get the standard SQL data type of this (dialect-specific) data type if available.

Specified by:
getSQLDataType in interface DataType<T>

getDataType

public final DataType<T> getDataType(Configuration configuration)
Description copied from interface: DataType
The dialect-specific data type representing this data type.

Specified by:
getDataType in interface DataType<T>

getSQLType

public int getSQLType()
Description copied from interface: DataType
Get JDBC Types value

Specified by:
getSQLType in interface DataType<T>

getType

public final Class<? extends T> getType()
Description copied from interface: DataType
Retrieve the Java type associated with this data type

Specified by:
getType in interface DataType<T>

getType

public final Class<?> getType(int precision,
                              int scale)
Description copied from interface: DataType
Retrieve a Java type associated with this data type and precision/scale

Specified by:
getType in interface DataType<T>

getArrayType

public final Class<? extends T[]> getArrayType()
Description copied from interface: DataType
Retrieve the Java type associated with ARRAYs of this data type

Specified by:
getArrayType in interface DataType<T>

getTypeName

public final String getTypeName()
Description copied from interface: DataType
Retrieve the dialect-specific type name associated with this data type

Specified by:
getTypeName in interface DataType<T>

getTypeName

public String getTypeName(Configuration configuration)
Description copied from interface: DataType
Retrieve the dialect-specific type name associated with this data type

Specified by:
getTypeName in interface DataType<T>

getCastTypeName

public final String getCastTypeName()
Description copied from interface: DataType
Retrieve the dialect-specific type name associated with this data type used for casting

This is useful for some dialects that have specialised type names for cast expressions. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767))

Specified by:
getCastTypeName in interface DataType<T>

getCastTypeName

public String getCastTypeName(Configuration configuration,
                              int precision,
                              int scale)
Description copied from interface: DataType
Retrieve the dialect-specific type name associated with this data type used for casting

This is useful for some dialects that have specialised type names for cast expressions. Other dialects require type-length binding when casting, (e.g. DECIMAL(20,5))

Specified by:
getCastTypeName in interface DataType<T>

getCastTypeName

public String getCastTypeName(Configuration configuration)
Description copied from interface: DataType
Retrieve the dialect-specific type name associated with this data type used for casting

This is useful for some dialects that have specialised type names for cast expressions. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767))

Specified by:
getCastTypeName in interface DataType<T>

getArrayDataType

public final DataType<T[]> getArrayDataType()
Description copied from interface: DataType
Retrieve the data type for an ARRAY of this data type

Specified by:
getArrayDataType in interface DataType<T>

asArrayDataType

public final <A extends ArrayRecord<T>> DataType<A> asArrayDataType(Class<A> arrayDataType)
Description copied from interface: DataType
Retrieve the data type for an Oracle-style ARRAY of this data type

Specified by:
asArrayDataType in interface DataType<T>

asMasterDataType

public final <M extends MasterDataType<T>> DataType<M> asMasterDataType(Class<M> masterDataType)
Description copied from interface: DataType
Retrieve the data type for a given master data type

Specified by:
asMasterDataType in interface DataType<T>

asEnumDataType

public final <E extends EnumType> DataType<E> asEnumDataType(Class<E> enumDataType)
Description copied from interface: DataType
Retrieve the data type for a given enum data type

Specified by:
asEnumDataType in interface DataType<T>

asConvertedDataType

public final <U> DataType<U> asConvertedDataType(Converter<? super T,U> converter)
Description copied from interface: DataType
Retrieve the data type for a given converter

Specified by:
asConvertedDataType in interface DataType<T>

getDialect

public final SQLDialect getDialect()
Description copied from interface: DataType
Retrieve the underlying SQLDialect

Specified by:
getDialect in interface DataType<T>

convert

public T convert(Object object)
Description copied from interface: DataType
Convert an arbitrary object into <T>

Specified by:
convert in interface DataType<T>
Parameters:
object - The object to be converted
Returns:
The converted object

getDefaultDataType

protected static DataType<Object> getDefaultDataType(SQLDialect dialect,
                                                     String typeName)

getDataType

protected static DataType<?> getDataType(SQLDialect dialect,
                                         String typeName)

getDataType

protected static <T> DataType<T> getDataType(SQLDialect dialect,
                                             Class<? extends T> type)

isNumeric

public final boolean isNumeric()
Description copied from interface: DataType
Whether this data type is any numeric data type. This applies to any of these types:

Specified by:
isNumeric in interface DataType<T>

isString

public final boolean isString()
Description copied from interface: DataType
Whether this data type is any character data type. This applies to any of these types:

Specified by:
isString in interface DataType<T>

isDateTime

public final boolean isDateTime()
Description copied from interface: DataType
Whether this data type is any date or time type. This applies to any of these types.

Specified by:
isDateTime in interface DataType<T>

isTemporal

public final boolean isTemporal()
Description copied from interface: DataType
Whether this data type is any date or time type. This applies to any of these types.

This is a combination of DataType.isDateTime() or DataType.isInterval()

Specified by:
isTemporal in interface DataType<T>

isInterval

public final boolean isInterval()
Description copied from interface: DataType
Whether this data type is any interval type. This applies to any of these types.

Specified by:
isInterval in interface DataType<T>

isBinary

public final boolean isBinary()
Description copied from interface: DataType
Whether this data type is any binary type. This applies to any of these types.

Specified by:
isBinary in interface DataType<T>

isArray

public final boolean isArray()
Description copied from interface: DataType
Whether this data type is an array type.

Specified by:
isArray in interface DataType<T>

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.