- 
- Type Parameters:
- T- The Java type associated with this SQL data type
 - All Superinterfaces:
- Serializable
 - All Known Implementing Classes:
- DefaultDataType
 
 public interface DataType<T> extends Serializable A common interface to all dialect-specific data types.jOOQ provides built in data types through SQLDataType. Users can define their own data types programmatically by callingasConvertedDataType(Converter)orasConvertedDataType(Binding), for example. Custom data types can also be defined on generated code using the<forcedType/>configuration, see the manual for more details- Author:
- Lukas Eder
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <A extends ArrayRecord<?>>
 DataType<A>asArrayDataType(Class<A> arrayDataType)Retrieve the data type for an Oracle-style ARRAY of this data type.<U> DataType<U>asConvertedDataType(Binding<? super T,U> binding)Retrieve the data type for a given binding.<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.CharacterSetcharacterSet()Get the character set of this data type, ornullif there is no character set, or if the default character set applies.DataType<T>characterSet(CharacterSet characterSet)Return a new data type like this, with a new character set.Collationcollation()Get the collation of this data type, ornullif there is no collation, or if the default collation applies.DataType<T>collation(Collation collation)Return a new data type like this, with a new collation.Tconvert(Object object)Convert an arbitrary object into<T>.T[]convert(Object... objects)Convert an arbitrary set of objects into<T>.List<T>convert(Collection<?> objects)Convert an arbitrary set of objects into<T>.Field<T>default_()The expression to be applied as theDEFAULTvalue for this data type.DataType<T>default_(Field<T> defaultValue)Specify an expression to be applied as theDEFAULTvalue for this data type.DataType<T>default_(T defaultValue)Specify an expression to be applied as theDEFAULTvalue for this data type.booleandefaulted()Get the defaultability of this data type.DataType<T>defaulted(boolean defaulted)Deprecated.- [#3852] - 3.8.0 - UsedefaultValue(Field)instead.Field<T>defaultValue()The expression to be applied as theDEFAULTvalue for this data type.DataType<T>defaultValue(Field<T> defaultValue)Specify an expression to be applied as theDEFAULTvalue for this data type.DataType<T>defaultValue(T defaultValue)Specify an expression to be applied as theDEFAULTvalue for this data type.DataType<T[]>getArrayDataType()Retrieve the data type for an ARRAY of this data type.Class<T[]>getArrayType()Retrieve the Java type associated with ARRAYs of this data type.Binding<?,T>getBinding()Get the data type binding associated with this data type.StringgetCastTypeName()Retrieve the dialect-specific type name associated with this data type used for casting.StringgetCastTypeName(Configuration configuration)Retrieve the dialect-specific type name associated with this data type used for casting.Converter<?,T>getConverter()Get the converter associated with this data type.DataType<T>getDataType(Configuration configuration)The dialect-specific data type representing this data type.SQLDialectgetDialect()Retrieve the underlyingSQLDialect.DataType<T>getSQLDataType()Get the standard SQL data type of this (dialect-specific) data type if available.intgetSQLType()Get JDBCTypesvalue.intgetSQLType(Configuration configuration)Get the dialect-specific JDBCTypesvalue.Class<T>getType()Retrieve the Java type associated with this data type.StringgetTypeName()Retrieve the dialect-specific type name associated with this data type.StringgetTypeName(Configuration configuration)Retrieve the dialect-specific type name associated with this data type.booleanhasLength()Whether this data type has a length.booleanhasPrecision()Whether this data type has a precision.booleanhasScale()Whether this data type has a scale.booleanidentity()Get the identity flag of this data type.DataType<T>identity(boolean identity)Return a new data type like this, with a new identity flag.booleanisArray()Whether this data type is an array type.booleanisBinary()Whether this data type is any binary type.booleanisDate()Whether this data type is any date type.booleanisDateTime()Whether this data type is any date or time type.booleanisEnum()Whether this data type is an enum type.booleanisInterval()Whether this data type is any interval type.booleanisLob()Whether this data type is best deserialised as aLOB.booleanisNumeric()Whether this data type is any numeric data type.booleanisString()Whether this data type is any character data type.booleanisTemporal()Whether this data type is any date or time type.booleanisTime()Whether this data type is any time type.booleanisTimestamp()Whether this data type is any timestamp type.booleanisUDT()Whether this data type is a UDT type.intlength()Get the length of this data type.DataType<T>length(int length)Return a new data type like this, with a new length value.Nullabilitynullability()Get the nullability of this data type.DataType<T>nullability(Nullability nullability)Return a new data type like this, with a new nullability.booleannullable()Get the nullability of this data type.DataType<T>nullable(boolean nullable)Return a new data type like this, with a new nullability.intprecision()Get the precision of this data type.DataType<T>precision(int precision)Return a new data type like this, with a new precision value.DataType<T>precision(int precision, int scale)Return a new data type like this, with a new precision and scale value.intscale()Get the scale of this data type.DataType<T>scale(int scale)Return a new data type like this, with a new scale value.
 
- 
- 
- 
Method Detail- 
getSQLDataTypeDataType<T> getSQLDataType() Get the standard SQL data type of this (dialect-specific) data type if available.
 - 
getDataTypeDataType<T> getDataType(Configuration configuration) The dialect-specific data type representing this data type.
 - 
getSQLTypeint getSQLType() Get JDBCTypesvalue.
 - 
getSQLTypeint getSQLType(Configuration configuration) Get the dialect-specific JDBCTypesvalue.
 - 
getArrayTypeClass<T[]> getArrayType() Retrieve the Java type associated with ARRAYs of this data type.
 - 
getArrayDataTypeDataType<T[]> getArrayDataType() Retrieve the data type for an ARRAY of this data type.
 - 
asArrayDataType@Pro <A extends ArrayRecord<?>> DataType<A> asArrayDataType(Class<A> arrayDataType) Retrieve the data type for an Oracle-style ARRAY of this data type.
 - 
asEnumDataType<E extends EnumType> DataType<E> asEnumDataType(Class<E> enumDataType) Retrieve the data type for a given enum data type.
 - 
asConvertedDataType<U> DataType<U> asConvertedDataType(Converter<? super T,U> converter) Retrieve the data type for a given converter.
 - 
asConvertedDataType<U> DataType<U> asConvertedDataType(Binding<? super T,U> binding) Retrieve the data type for a given binding.
 - 
getTypeNameString getTypeName() Retrieve the dialect-specific type name associated with this data type.
 - 
getTypeNameString getTypeName(Configuration configuration) Retrieve the dialect-specific type name associated with this data type.
 - 
getCastTypeNameString 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. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767)) 
 - 
getCastTypeNameString 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. Other dialects require type-length binding when casting, (e.g. VARCHAR(32767)) 
 - 
getDialectSQLDialect getDialect() Retrieve the underlyingSQLDialect.
 - 
convertT convert(Object object) Convert an arbitrary object into<T>.See Convert.convert(Object, Class)for details about conversion rules.- Parameters:
- object- The object to be converted
- Returns:
- The converted object
- Throws:
- DataTypeException- If conversion fails.
 
 - 
convertT[] convert(Object... objects) Convert an arbitrary set of objects into<T>.See Convert.convert(Object, Class)for details about conversion rules.- Parameters:
- objects- The objects to be converted
- Returns:
- The converted objects
- Throws:
- DataTypeException- If conversion fails.
 
 - 
convertList<T> convert(Collection<?> objects) Convert an arbitrary set of objects into<T>.See Convert.convert(Object, Class)for details about conversion rules.- Parameters:
- objects- The objects to be converted
- Returns:
- The converted objects
- Throws:
- DataTypeException- If conversion fails.
 
 - 
nullability@Support DataType<T> nullability(Nullability nullability) Return a new data type like this, with a new nullability.[#5709] A nullablecolumn cannot have anidentity().- Parameters:
- nullability- The new nullability
- Returns:
- The new data type
 
 - 
nullabilityNullability nullability() Get the nullability of this data type.- Returns:
- The nullability
 
 - 
nullable@Support DataType<T> nullable(boolean nullable) Return a new data type like this, with a new nullability.This is the same as calling nullability(Nullability)with any ofNullability.NULLorNullability.NOT_NULLas an argument.[#5709] A nullablecolumn cannot have anidentity().- Parameters:
- nullable- The new nullability
- Returns:
- The new data type
 
 - 
nullableboolean nullable() Get the nullability of this data type.This returns trueby default, i.e. ifnullability()isNullability.DEFAULT.- Returns:
- The nullability
 
 - 
collation@Support({AURORA_MYSQL,AURORA_POSTGRES,HSQLDB,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER}) DataType<T> collation(Collation collation) Return a new data type like this, with a new collation.
 - 
collationCollation collation() Get the collation of this data type, ornullif there is no collation, or if the default collation applies.
 - 
characterSet@Support({AURORA_MYSQL,MARIADB,MEMSQL,MYSQL}) DataType<T> characterSet(CharacterSet characterSet) Return a new data type like this, with a new character set.
 - 
characterSetCharacterSet characterSet() Get the character set of this data type, ornullif there is no character set, or if the default character set applies.
 - 
identity@Support DataType<T> identity(boolean identity) Return a new data type like this, with a new identity flag.[#5709] The IDENTITY flag imposes a NOT NULL constraint, and removes all DEFAULT values. - Parameters:
- identity- The new identity flag
- Returns:
- The new data type
 
 - 
identityboolean identity() Get the identity flag of this data type.- Returns:
- The identity flag.
 
 - 
defaultValue@Support DataType<T> defaultValue(T defaultValue) Specify an expression to be applied as theDEFAULTvalue for this data type.[#5709] A defaultedcolumn cannot have anidentity().This is an alias for default_(Object).- See Also:
- defaultValue(Field)
 
 - 
defaultValueDataType<T> defaultValue(Field<T> defaultValue) Specify an expression to be applied as theDEFAULTvalue for this data type.A default value of a data type applies to DDL statements, such as - CREATE TABLE
- ALTER TABLE
 The distinct types of possible DEFAULTexpressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible.This is an alias for default_(Field).
 - 
defaultValueField<T> defaultValue() The expression to be applied as theDEFAULTvalue for this data type.This is an alias for default_().- Returns:
- The default value if present, or nullif no default value is specified for this data type.
- See Also:
- defaultValue(Field)
 
 - 
default_@Support DataType<T> default_(T defaultValue) Specify an expression to be applied as theDEFAULTvalue for this data type.[#5709] A defaultedcolumn cannot have anidentity().- See Also:
- defaultValue(Field)
 
 - 
default_@Support DataType<T> default_(Field<T> defaultValue) Specify an expression to be applied as theDEFAULTvalue for this data type.A default value of a data type applies to DDL statements, such as - CREATE TABLE
- ALTER TABLE
 The distinct types of possible DEFAULTexpressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible.
 - 
default_Field<T> default_() The expression to be applied as theDEFAULTvalue for this data type.- Returns:
- The default value if present, or nullif no default value is specified for this data type.
- See Also:
- defaultValue(Field)
 
 - 
defaulted@Deprecated DataType<T> defaulted(boolean defaulted) Deprecated.- [#3852] - 3.8.0 - UsedefaultValue(Field)instead.Return a new data type like this, with a new defaultability.- Parameters:
- defaulted- The new defaultability
- Returns:
- The new data type
 
 - 
defaultedboolean defaulted() Get the defaultability of this data type.- Returns:
- The defaultability
 
 - 
precision@Support DataType<T> precision(int precision) Return a new data type like this, with a new precision value.This will have no effect if hasPrecision()isfalseThis is the same as calling precision(int, int)withscale == 0- Parameters:
- precision- The new precision value
- Returns:
- The new data type
 
 - 
precision@Support DataType<T> precision(int precision, int scale) Return a new data type like this, with a new precision and scale value.This will have no effect if hasPrecision()isfalse, or ifscale > 0andhasScale()isfalse- Parameters:
- precision- The new precision value
- scale- The new scale value
- Returns:
- The new data type
 
 - 
precisionint precision() Get the precision of this data type.- Returns:
- The precision of this data type
 
 - 
hasPrecisionboolean hasPrecision() Whether this data type has a precision.- Returns:
- Whether this data type has a precision
 
 - 
scale@Support DataType<T> scale(int scale) Return a new data type like this, with a new scale value.This will have no effect if hasScale()isfalse- Parameters:
- scale- The new scale value
- Returns:
- The new data type
 
 - 
scaleint scale() Get the scale of this data type.- Returns:
- The scale of this data type
 
 - 
hasScaleboolean hasScale() Whether this data type has a scale.- Returns:
- Whether this data type has a scale
 
 - 
length@Support DataType<T> length(int length) Return a new data type like this, with a new length value.This will have no effect if hasLength()isfalse- Parameters:
- length- The new length value
- Returns:
- The new data type
 
 - 
lengthint length() Get the length of this data type.- Returns:
- The length of this data type
 
 - 
hasLengthboolean hasLength() Whether this data type has a length.- Returns:
- Whether this data type has a length
 
 - 
isNumericboolean isNumeric() Whether this data type is any numeric data type.This applies to any of these types: 
 - 
isStringboolean isString() Whether this data type is any character data type.This applies to any of these types: 
 - 
isDateTimeboolean isDateTime() Whether this data type is any date or time type.This applies to any of these types. - See Also:
- isDate()
 
 - 
isDateboolean isDate() Whether this data type is any date type.This applies to any of these types. 
 - 
isTimestampboolean isTimestamp() Whether this data type is any timestamp type.This applies to any of these types. 
 - 
isTimeboolean isTime() Whether this data type is any time type.This applies to any of these types. 
 - 
isTemporalboolean isTemporal() Whether this data type is any date or time type.This applies to any of these types. -  SQLDataType.DATE
-  SQLDataType.TIME
-  SQLDataType.TIMESTAMP
-  SQLDataType.LOCALDATE
-  SQLDataType.LOCALTIME
-  SQLDataType.LOCALDATETIME
-  SQLDataType.OFFSETTIME
-  SQLDataType.OFFSETDATETIME
-  YearToSecond
-  YearToMonth
-  DayToSecond
 This is a combination of isDateTime()orisInterval()
-  
 - 
isIntervalboolean isInterval() Whether this data type is any interval type.This applies to any of these types. 
 - 
isBinaryboolean isBinary() Whether this data type is any binary type.This applies to any of these types. 
 - 
isLobboolean isLob() Whether this data type is best deserialised as aLOB.This applies to any of these types. 
 - 
isArrayboolean isArray() Whether this data type is an array type.
 - 
isUDTboolean isUDT() Whether this data type is a UDT type.
 - 
isEnumboolean isEnum() Whether this data type is an enum type.
 
- 
 
-