Top Description Methods
org.jooq

public Interface DataType<T>

extends Named
Known Direct Implementers
org.jooq.impl.AbstractDataType
Type Parameters
<T>
The Java type associated with this SQL data type
Static Imports
org.jooq.SQLDialect.CUBRID, .SQLDialect.DERBY, .SQLDialect.FIREBIRD, .SQLDialect.H2, .SQLDialect.HSQLDB, .SQLDialect.IGNITE, .SQLDialect.MARIADB, .SQLDialect.MYSQL, .SQLDialect.POSTGRES, .SQLDialect.SQLITE, .SQLDialect.YUGABYTEDB

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 calling asConvertedDataType(Converter) or asConvertedDataType(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 Summary

Modifier and TypeMethod and Description
public @NotNull DataType<T[]>
array()

A convenient short for form getArrayDataType() for DSL usage

public <U> @NotNull DataType<U>
asConvertedDataType(Converter<? super T, U> converter)

Retrieve the data type for a given converter.

public default <U> @NotNull DataType<U>
asConvertedDataType(Class<U> toType, Function<? super T, ? extends U> from, Function<? super U, ? extends T> to)

Convenience method for converting this type using Converter#of(Class, Class, Function, Function).

public <U> @NotNull DataType<U>
asConvertedDataType(Binding<? super T, U> binding)

Retrieve the data type for a given binding.

public default <U> @NotNull DataType<U>
asConvertedDataTypeFrom(Class<U> toType, Function<? super T, ? extends U> from)

Convenience method for converting this type to a read-only type using Converter#from(Class, Class, Function).

public default <U> @NotNull DataType<U>
asConvertedDataTypeFrom(Function<? super T, ? extends U> from)

Convenience method for converting this type to a read-only type using Converter#from(Class, Class, Function).

public default <U> @NotNull DataType<U>
asConvertedDataTypeTo(Class<U> toType, Function<? super U, ? extends T> to)

Convenience method for converting this type to a write-only type using Converter#to(Class, Class, Function).

public default <U> @NotNull DataType<U>
asConvertedDataTypeTo(Function<? super U, ? extends T> to)

Convenience method for converting this type to a write-only type using Converter#to(Class, Class, Function).

public <E extends EnumType> @NotNull DataType<E>
asEnumDataType(Class<E> enumDataType)

Retrieve the data type for a given enum data type.

public @NotNull DataType<T>
characterSet(CharacterSet characterSet)

Return a new data type like this, with a new character set.

public @Nullable CharacterSet
characterSet()

Get the character set of this data type, or null if there is no character set, or if the default character set applies.

public @NotNull DataType<T>
collation(Collation collation)

Return a new data type like this, with a new collation.

public @Nullable Collation
collation()

Get the collation of this data type, or null if there is no collation, or if the default collation applies.

public boolean
computed()

Whether this column is computed.

public boolean
computedOnClient()

Whether this column is computed on the client.

public boolean
computedOnClient(Configuration configuration)

Whether this column is computed on the client.

public boolean
computedOnClientStored()

Whether this column is computed on the client.

public boolean
computedOnClientStored(Configuration configuration)

Whether this column is computed on the client.

public boolean
computedOnClientStoredOn(GeneratorStatementType statementType)

Whether this column is computed on the client.

public boolean
computedOnClientStoredOn(GeneratorStatementType statementType, Configuration configuration)

Whether this column is computed on the client.

public boolean
computedOnClientVirtual()

Whether this column is computed on the client.

public boolean
computedOnClientVirtual(Configuration configuration)

Whether this column is computed on the client.

public boolean
computedOnServer()

Whether this column is computed on the server.

public boolean
computedOnServer(Configuration configuration)

Whether this column is computed on the server.

public T

Returns:

The converted object
convert
(Object
The object to be converted
object
)

Convert an arbitrary object into <T>.

public @NotNull T[]

Returns:

The converted objects
convert
(Object...
The objects to be converted
objects
)

Convert an arbitrary set of objects into <T>.

public @NotNull List<T>

Returns:

The converted objects
convert
(Collection<?>
The objects to be converted
objects
)

Convert an arbitrary set of objects into <T>.

public @NotNull DataType<T>
default_(T defaultValue)

Specify an expression to be applied as the DEFAULT value for this data type.

public @NotNull DataType<T>
default_(Field<T> defaultValue)

Deprecated as a consequence of Field being deprecated.
Specify an expression to be applied as the DEFAULT value for this data type.
public @Nullable Field<T>

Returns:

The default value if present, or null if no default value is specified for this data type.
default_
()

Deprecated as a consequence of Field being deprecated.
The expression to be applied as the DEFAULT value for this data type.
public @NotNull DataType<T>

Returns:

The new data type
defaulted
(boolean
The new defaultability
defaulted
)

Deprecated for removal since 3.8. - [#3852] - 3.8.0 - Use defaultValue(Field) instead.
Return a new data type like this, with a new defaultability.
public boolean

Returns:

The defaultability
defaulted
()

Get the defaultability of this data type.

public @NotNull DataType<T>
defaultValue(T defaultValue)

Specify an expression to be applied as the DEFAULT value for this data type.

public @NotNull DataType<T>
defaultValue(Field<T> defaultValue)

Deprecated as a consequence of Field being deprecated.
Specify an expression to be applied as the DEFAULT value for this data type.
public @Nullable Field<T>

Returns:

The default value if present, or null if no default value is specified for this data type.
defaultValue
()

Deprecated as a consequence of Field being deprecated.
The expression to be applied as the DEFAULT value for this data type.
public @NotNull DataType<T>
generatedAlwaysAs(T generatedAlwaysAsValue)

Set the computed column expression of this data type to a constant value.

public @NotNull DataType<T>
generatedAlwaysAs(Field<T> generatedAlwaysAsValue)

Deprecated as a consequence of Field being deprecated.
Set the computed column expression of this data type to a constant expression.
public @NotNull DataType<T>
generatedAlwaysAs(Generator<?, ?, T> generatedAlwaysAsValue)

Set the computed column expression of this data type to a dynamic expression.

public @Nullable Field<T>
generatedAlwaysAs()

Deprecated as a consequence of Field being deprecated.
Get the computed column expression of this data type, if any.
public @Nullable Generator<?, ?, T>
generatedAlwaysAsGenerator()

Get the computed column expression of this data type, if any.

public @NotNull DataType<T>
generationLocation(QOM.GenerationLocation generationOption)

Set the generationLocation() of the computed column expression.

public @NotNull QOM.GenerationLocation
generationLocation()

Get the GenerationLocation of the computed column expression of this data type, if any.

public @NotNull DataType<T>
generationOption(QOM.GenerationOption generationOption)

Set the generationOption() of the computed column expression.

public @NotNull QOM.GenerationOption
generationOption()

Get the GenerationOption of the computed column expression of this data type, if any.

public @NotNull DataType<?>
getArrayBaseDataType()

Retrieve the Java component data type if this is an ARRAY type, or this, otherwise.

public @NotNull Class<?>
getArrayBaseType()

Retrieve the Java base type if this is an ARRAY type, or getType(), otherwise.

public @Nullable DataType<?>
getArrayComponentDataType()

Retrieve the Java component data type if this is an ARRAY type, or null, otherwise.

public @Nullable Class<?>
getArrayComponentType()

Retrieve the Java component type if this is an ARRAY type, or null, otherwise.

public @NotNull DataType<T[]>
getArrayDataType()

Retrieve the data type for an ARRAY of this data type.

public @NotNull Class<T[]>
getArrayType()

Retrieve the Java type associated with ARRAYs of this data type.

public @NotNull Binding<?, T>
getBinding()

Get the data type binding associated with this data type.

public @NotNull String
getCastTypeName()

Retrieve the dialect-specific type name associated with this data type used for casting.

public @NotNull String
getCastTypeName(Configuration configuration)

Retrieve the dialect-specific type name associated with this data type used for casting.

public @NotNull ContextConverter<?, T>
getConverter()

Get the converter associated with this data type.

public @NotNull DataType<T>
getDataType(Configuration configuration)

The dialect-specific data type representing this data type.

public @Nullable SQLDialect
getDialect()

Retrieve the underlying SQLDialect.

public @Nullable Domain<T>
getDomain()

Get the defining DOMAIN type or NULL if there is no such type.

public @Nullable Class<? extends Record>
getRecordType()

Get the nested record's record type definition, if this is a isRecord(), or a isMultiset(), or NULL otherwise.

public @Nullable Row
getRow()

Get the nested record's Row definition, if this is a isRecord(), or a isMultiset(), or NULL otherwise.

public @Nullable DataType<T>
getSQLDataType()

Get the standard SQL data type of this (dialect-specific) data type if available.

public int
getSQLType()

Get JDBC Types value.

public int
getSQLType(Configuration configuration)

Get the dialect-specific JDBC Types value.

public @NotNull Class<T>
getType()

Retrieve the Java type associated with this data type.

public @NotNull String
getTypeName()

Retrieve the dialect-specific type name associated with this data type.

public @NotNull String
getTypeName(Configuration configuration)

Retrieve the dialect-specific type name associated with this data type.

public boolean

Returns:

Whether this data type has a length
hasLength
()

Whether this data type has a length.

public boolean

Returns:

Whether this data type has a precision
hasPrecision
()

Whether this data type has a precision.

public boolean

Returns:

Whether this data type has a scale
hasScale
()

Whether this data type has a scale.

public @NotNull DataType<T>

Returns:

The new data type
identity
(boolean
The new identity flag
identity
)

Return a new data type like this, with a new identity flag.

public boolean

Returns:

The identity flag.
identity
()

Get the identity flag of this data type.

public boolean
isArray()

Whether this data type is an array type.

public boolean
isAssociativeArray()

Whether this data type is an array type.

public boolean
isBinary()

Whether this data type is any binary type.

public boolean
isBoolean()

Whether this data type is any boolean data type.

public boolean
isDate()

Whether this data type is any date type.

public boolean
isDateTime()

Whether this data type is any date or time type.

public boolean
isEmbeddable()

Whether this data type is an embeddable type.

public boolean
isEnum()

Whether this data type is an enum type.

public boolean
isFloat()

Whether this data type is any floating point data type.

public boolean
isInteger()

Whether this data type is any integer data type.

public boolean
isInterval()

Whether this data type is any interval type.

public boolean
isJSON()

Whether this data type is a JSON type.

public boolean
isLob()

Whether this data type is best deserialised as a LOB.

public boolean
isMultiset()

Whether this data type is a nested collection type.

public boolean
isNString()

Whether this data type is any national character data type.

public boolean
isNumeric()

Whether this data type is any numeric data type.

public boolean
isRecord()

Whether this data type is a nested record type.

public boolean
isSpatial()

Whether this data type is a spatial type.

public boolean
isString()

Whether this data type is any character data type.

public boolean
isTemporal()

Whether this data type is any date or time type.

public boolean
isTime()

Whether this data type is any time type.

public boolean
isTimestamp()

Whether this data type is any timestamp type.

public boolean
isUDT()

Whether this data type is a UDT type.

public boolean
isXML()

Whether this data type is an XML type.

public @NotNull DataType<T>

Returns:

The new data type
length
(int
The new length value
length
)

Return a new data type like this, with a new length value.

public int

Returns:

The length of this data type
length
()

Get the length of this data type.

public boolean
lengthDefined()

Whether the precision returned by length() is defined.

public @NotNull DataType<T>
notNull()

Synonym for nullable(boolean), passing false as an argument.

public @NotNull DataType<T>
null_()

Synonym for nullable(boolean), passing true as an argument.

public @NotNull DataType<T>

Returns:

The new data type
nullability
(Nullability
The new nullability
nullability
)

Return a new data type like this, with a new nullability.

public @NotNull Nullability

Returns:

The nullability
nullability
()

Get the nullability of this data type.

public @NotNull DataType<T>

Returns:

The new data type
nullable
(boolean
The new nullability
nullable
)

Return a new data type like this, with a new nullability.

public boolean

Returns:

The nullability
nullable
()

Get the nullability of this data type.

public @NotNull DataType<T>

Returns:

The new data type
precision
(int
The new precision value
precision
)

Return a new data type like this, with a new precision value.

public @NotNull DataType<T>

Returns:

The new data type
precision
(int
The new precision value
precision
,
int
The new scale value
scale
)

Return a new data type like this, with a new precision and scale value.

public int

Returns:

The precision of this data type
precision
()

Get the precision of this data type.

public boolean
precisionDefined()

Whether the precision returned by precision() is defined.

public @NotNull DataType<T>

Returns:

The new data type
readonly
(boolean
The new readonly attribute value.
readonly
)

Return a new data type like this, with a new readonly attribute.

public boolean
readonly()

Get the readonly attribute of this data type.

public boolean
readonlyInternal()

Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.

public boolean
readonlyInternal(Configuration configuration)

Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.

public @NotNull DataType<T>

Returns:

The new data type
scale
(int
The new scale value
scale
)

Return a new data type like this, with a new scale value.

public int

Returns:

The scale of this data type
scale
()

Get the scale of this data type.

public boolean
scaleDefined()

Whether the precision returned by scale() is defined.

public @NotNull DataType<T>
stored()

Set the generationOption() of the computed column expression to GenerationOption#STORED.

public @NotNull DataType<T>
virtual()

Set the generationOption() of the computed column expression to GenerationOption#VIRTUAL.

Inherited from org.jooq.Named:
$namegetCommentgetCommentPartgetNamegetQualifiedNamegetUnqualifiedName