- All Implemented Interfaces:
Serializable
,DataType<T>
,Named
,QueryPart
,QueryPartInternal
DefaultDataType
, to be used only by
built-in data types in SQLDataType
and dialect specific data type
classes, such as e.g. PostgresDataType
.- Author:
- Lukas Eder
- See Also:
-
Constructor Summary
ConstructorDescriptionBuiltInDataType
(Class<T> type, String typeName) Constructor forSQLDataType
types.BuiltInDataType
(SQLDialect dialect, DataType<T> sqlDataType, String typeName) Constructor for dialect specific data types.BuiltInDataType
(SQLDialect dialect, DataType<T> sqlDataType, String typeName, String castTypeName) Constructor for dialect specific data types. -
Method Summary
Modifier and TypeMethodDescriptionfinal Name
$name()
Experimental query object model accessor method, see alsoQOM
.default QueryPart
Traverse aQueryPart
hierarchy and recursively replace its elements by alternatives.default <R> R
final void
array()
A convenient short for formDataType.getArrayDataType()
for DSL usagefinal <A extends ArrayRecord<?>>
DataType<A> asArrayDataType
(Class<A> arrayDataType) Retrieve the data type for an Oracle-style ARRAY of this data type.final <A extends AssociativeArrayRecord<?,
?>>
DataType<A> asAssociativeArrayDataType
(Class<A> arrayDataType) Retrieve the data type for an Oracle-style associative array of this data type.<U> DataType
<U> asConvertedDataType
(Binding<? super T, U> newBinding) 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.asEnumDataType
(Class<E> enumDataType) Retrieve the data type for a given enum data type.Return a new data type like this, with theDataType.identity(boolean)
flag set totrue
.Return a new data type like this, with a new character set.Clause[]
Deprecated.- 3.11.0 - [#8179] - This functionality will be removed in the future.Return a new data type like this, with a new collation.final boolean
computed()
Whether this column is computed.final boolean
Whether this column is computed on the client.final boolean
computedOnClient
(Configuration configuration) Whether this column is computed on the client.final boolean
Whether this column is computed on the client.final boolean
computedOnClientStored
(Configuration configuration) Whether this column is computed on the client.final boolean
computedOnClientStoredOn
(GeneratorStatementType statementType) Whether this column is computed on the client.final boolean
computedOnClientStoredOn
(GeneratorStatementType statementType, Configuration configuration) Whether this column is computed on the client.final boolean
Whether this column is computed on the client.final boolean
computedOnClientVirtual
(Configuration configuration) Whether this column is computed on the client.final boolean
Whether this column is computed on the server.final boolean
computedOnServer
(Configuration configuration) Whether this column is computed on the server.final T
Convert an arbitrary object into<T>
.final T[]
Convert an arbitrary set of objects into<T>
.convert
(Collection<?> objects) Convert an arbitrary set of objects into<T>
.protected final DSLContext
create()
Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.protected final DSLContext
create
(Configuration configuration) Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.protected final DSLContext
Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.boolean
Subclasses may override thisboolean
Subclasses may override thisboolean
Subclasses may override thisboolean
Subclasses may override thisboolean
Subclasses may override thisSpecify an expression to be applied as theDEFAULT
value for this data type.Specify an expression to be applied as theDEFAULT
value for this data type.final boolean
Get the defaultability of this data type.The expression to be applied as theDEFAULT
value for this data type.defaultValue
(Field<T> d) Specify an expression to be applied as theDEFAULT
value for this data type.defaultValue
(T d) Specify an expression to be applied as theDEFAULT
value for this data type.boolean
Check whether thisQueryPart
can be considered equal to anotherQueryPart
.Get the computed column expression of this data type, if any.generatedAlwaysAs
(Field<T> generatedAlwaysAsValue) Set the computed column expression of this data type to a constant expression.generatedAlwaysAs
(Generator<?, ?, T> g) Set the computed column expression of this data type to a dynamic expression.Set the computed column expression of this data type to a constant value.Return a new data type like this, with theDataType.identity(boolean)
flag set totrue
.boolean
Subclasses may override thisSet theDataType.generationLocation()
of the computed column expression.Set theDataType.generationOption()
of the computed column expression.DataType
<?> Retrieve the Java component data type if this is an ARRAY type, orthis
, otherwise.Class
<?> Retrieve the Java base type if this is an ARRAY type, orDataType.getType()
, otherwise.DataType
<?> Retrieve the Java component data type if this is an ARRAY type, ornull
, otherwise.Class
<?> Retrieve the Java component type if this is an ARRAY type, ornull
, otherwise.Retrieve the data type for an ARRAY of this data type.Retrieve the Java type associated with ARRAYs of this data type.Retrieve the dialect-specific type name associated with this data type used for casting.getCastTypeName
(Configuration configuration) Retrieve the dialect-specific type name associated with this data type used for casting.final String
The comment on this object.final Comment
The comment on this object as aQueryPart
.final ContextConverter
<?, T> Get the converter associated with this data type.Get the defining DOMAIN type orNULL
if there is no such type.final String
getName()
The unqualified name of this object.The qualified name of this object.Get the nested record's record type definition, if this is aDataType.isRecord()
, or aDataType.isMultiset()
, orNULL
otherwise.getRow()
Get the nested record'sRow
definition, if this is aDataType.isRecord()
, or aDataType.isMultiset()
, orNULL
otherwise.int
Get JDBCTypes
value.final int
getSQLType
(Configuration configuration) Get the dialect-specific JDBCTypes
value.Retrieve the dialect-specific type name associated with this data type.getTypeName
(Configuration configuration) Retrieve the dialect-specific type name associated with this data type.final Name
The unqualified name of this object.final boolean
Whether this data type has a fixed length.int
hashCode()
Generate a hash code from thisQueryPart
.final boolean
Whether this data type has a length.final boolean
Whether this data type has a precision.final boolean
hasScale()
Whether this data type has a scale.hidden
(boolean h) Return a new data type like this, with a new hidden attribute.identity
(boolean i) Return a new data type like this, with a new identity flag.final boolean
isArray()
Whether this data type is an array type.final boolean
Whether this data type is an array type.final boolean
isBinary()
Whether this data type is any binary type.final boolean
Whether this data type is any boolean data type.final boolean
isDate()
Whether this data type is any date type.final boolean
Whether this data type is any date or time type.final boolean
Whether this data type is any decimal numeric data type.final boolean
Whether this data type is an embeddable type.final boolean
isEnum()
Whether this data type is an enum type.final boolean
isFloat()
Whether this data type is any floating point data type.final boolean
Whether this data type is any integer data type.final boolean
Whether this data type is any interval type.final boolean
isJSON()
Whether this data type is a JSON type.final boolean
isLob()
Whether this data type is best deserialised as aLOB
.boolean
Whether this data type is a nested collection type.final boolean
Whether this data type is any national character data type.final boolean
Whether this data type is any numeric data type.final boolean
isOther()
Whether this data type is an OTHER type.boolean
isRecord()
Whether this data type is a nested record type.final boolean
Whether this data type is a spatial type.final boolean
isString()
Whether this data type is any character data type.final boolean
Whether this data type is any date or time type.final boolean
isTime()
Whether this data type is any time type.final boolean
Whether this data type is any timestamp type.final boolean
Whether this data type is any timestamp type.final boolean
Whether this data type is any time type.final boolean
isUDT()
Whether this data type is a UDT type.final boolean
isUUID()
Whether this data type is a UUID type.final boolean
isXML()
Whether this data type is an XML type.final int
length()
Get the length of this data type.length
(int l) Return a new data type like this, with a new length value.final boolean
Whether the precision returned byDataType.length()
is defined.notNull()
Synonym forDataType.nullable(boolean)
, passingfalse
as an argument.null_()
Synonym forDataType.nullable(boolean)
, passingtrue
as an argument.Return a new data type like this, with a new nullability.final boolean
nullable()
Get the nullability of this data type.nullable
(boolean n) Return a new data type like this, with a new nullability.final int
Get the precision of this data type.precision
(int p) Return a new data type like this, with a new precision value.precision
(int p, int s) Return a new data type like this, with a new precision and scale value.final boolean
Whether the precision returned byDataType.precision()
is defined.readonly
(boolean r) Return a new data type like this, with a new readonly attribute.final boolean
Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.final boolean
readonlyInternal
(Configuration configuration) Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.boolean
rendersContent
(Context<?> ctx) Subclasses may override thisfinal int
scale()
Get the scale of this data type.scale
(int s) Return a new data type like this, with a new scale value.final boolean
Whether the precision returned byDataType.scale()
is defined.stored()
Set theDataType.generationOption()
of the computed column expression toQOM.GenerationOption.STORED
.toString()
Render a SQL string representation of thisQueryPart
.protected final DataAccessException
translate
(String sql, SQLException e) Internal convenience methodvirtual()
Set theDataType.generationOption()
of the computed column expression toQOM.GenerationOption.VIRTUAL
.Methods inherited from class org.jooq.impl.DefaultDataType
characterSet, collation, default_, generatedAlwaysAsGenerator, generationLocation, generationOption, getBinding, getDataType, getDataType, getDataType, getDataType, getDataType, getDataType, getDataType, getDataType, getDefaultDataType, getDefaultDataType, getDialect, getSQLDataType, getType, getType, hidden, identity, normalise, nullability, readonly
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jooq.DataType
asConvertedDataType, asConvertedDataTypeFrom, asConvertedDataTypeFrom, asConvertedDataTypeTo, asConvertedDataTypeTo
Methods inherited from interface org.jooq.Named
$name, getComment, getCommentPart, getName, getQualifiedName, getUnqualifiedName
-
Constructor Details
-
BuiltInDataType
Constructor forSQLDataType
types. -
BuiltInDataType
Constructor for dialect specific data types. -
BuiltInDataType
public BuiltInDataType(SQLDialect dialect, DataType<T> sqlDataType, String typeName, String castTypeName) Constructor for dialect specific data types.
-
-
Method Details
-
nullability
Description copied from interface:DataType
Return a new data type like this, with a new nullability.[#5709] A
nullable
column cannot have anDataType.identity()
.- Specified by:
nullability
in interfaceDataType<T>
- Parameters:
n
- The new nullability- Returns:
- The new data type
-
readonly
Description copied from interface:DataType
Return a new data type like this, with a new readonly attribute.This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
Description copied from interface:DataType
Set the computed column expression of this data type to a dynamic expression.Unlike
DataType.generatedAlwaysAs(Object)
andDataType.generatedAlwaysAs(Field)
, which produce a constant value or expression, this allows for generating a dynamic expression if used along withDataType.generationLocation()
andQOM.GenerationLocation.CLIENT
, in order to implement client side computed columns.If
DataType.generationLocation()
isQOM.GenerationLocation.SERVER
, then this does not affect generated DML statements, and will be evaluated only in DDL statements, when creating the table.This implicitly sets
DataType.readonly()
totrue
.This feature is implemented in commercial distributions only.
- Specified by:
generatedAlwaysAs
in interfaceDataType<T>
-
generationOption
Description copied from interface:DataType
Set theDataType.generationOption()
of the computed column expression.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
- Specified by:
generationOption
in interfaceDataType<T>
-
generationLocation
Description copied from interface:DataType
Set theDataType.generationLocation()
of the computed column expression.Specifies whether the
DataType.generatedAlwaysAs()
expression is computed on theQOM.GenerationLocation.SERVER
(by default) or in theQOM.GenerationLocation.CLIENT
. The latter is supported in all dialects, the former only in relevant dialects.The computation happens in
Insert
,Update
, orMerge
statements in caseDataType.generationOption()
isQOM.GenerationOption.STORED
, or inSelect
in case theDataType.generationOption()
isQOM.GenerationOption.VIRTUAL
.This feature is implemented in commercial distributions only.
- Specified by:
generationLocation
in interfaceDataType<T>
-
collation
Description copied from interface:DataType
Return a new data type like this, with a new collation. -
characterSet
Description copied from interface:DataType
Return a new data type like this, with a new character set.- Specified by:
characterSet
in interfaceDataType<T>
-
identity
Description copied from interface:DataType
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.
-
default_
Description copied from interface:DataType
Specify an expression to be applied as theDEFAULT
value 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
DEFAULT
expressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible. -
nullable
Description copied from interface:DataType
Return a new data type like this, with a new nullability.This is the same as calling
DataType.nullability(Nullability)
with any ofNullability.NULL
orNullability.NOT_NULL
as an argument.[#5709] A
nullable
column cannot have anDataType.identity()
. -
nullable
public final boolean nullable()Description copied from interface:DataType
Get the nullability of this data type.This returns
true
by default, i.e. ifDataType.nullability()
isNullability.DEFAULT
. -
null_
Description copied from interface:DataType
Synonym forDataType.nullable(boolean)
, passingtrue
as an argument. -
notNull
Description copied from interface:DataType
Synonym forDataType.nullable(boolean)
, passingfalse
as an argument. -
readonlyInternal
public final boolean readonlyInternal()Description copied from interface:DataType
Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.A column may be marked as
DataType.readonly()
for various reasons, including:- When it is marked as readonly explicitly by the code generator.
- When it is marked as readonly implicitly because it's a computed
column with
QOM.GenerationLocation.SERVER
or withQOM.GenerationLocation.CLIENT
andQOM.GenerationOption.VIRTUAL
.
Some columns are readonly for users, meaning users of the jOOQ API cannot write to them, but jOOQ, internally, may still write to those columns. Such columns may include:
- Columns that are computed with
QOM.GenerationLocation.CLIENT
andQOM.GenerationOption.STORED
- Columns used for optimistic locking
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.readonlyInternal(Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
readonlyInternal
in interfaceDataType<T>
-
readonlyInternal
Description copied from interface:DataType
Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.A column may be marked as
DataType.readonly()
for various reasons, including:- When it is marked as readonly explicitly by the code generator.
- When it is marked as readonly implicitly because it's a computed
column with
QOM.GenerationLocation.SERVER
or withQOM.GenerationLocation.CLIENT
andQOM.GenerationOption.VIRTUAL
.
Some columns are readonly for users, meaning users of the jOOQ API cannot write to them, but jOOQ, internally, may still write to those columns. Such columns may include:
- Columns that are computed with
QOM.GenerationLocation.CLIENT
andQOM.GenerationOption.STORED
- Columns used for optimistic locking
This feature is implemented in commercial distributions only.
- Specified by:
readonlyInternal
in interfaceDataType<T>
-
computed
public final boolean computed()Description copied from interface:DataType
Whether this column is computed.This feature is implemented in commercial distributions only.
-
computedOnServer
public final boolean computedOnServer()Description copied from interface:DataType
Whether this column is computed on the server.This is true only if all of these hold true:
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.computedOnServer(Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnServer
in interfaceDataType<T>
-
computedOnServer
Description copied from interface:DataType
Whether this column is computed on the server.This is true only if all of these hold true:
This feature is implemented in commercial distributions only.
- Specified by:
computedOnServer
in interfaceDataType<T>
-
computedOnClient
public final boolean computedOnClient()Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.computedOnClient(Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClient
in interfaceDataType<T>
-
computedOnClient
Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
Alternatively, this makes the result true as well:
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClient
in interfaceDataType<T>
-
computedOnClientStored
public final boolean computedOnClientStored()Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.STORED
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
any ofGeneratorStatementType.INSERT
orGeneratorStatementType.UPDATE
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.computedOnClientStored(Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStored
in interfaceDataType<T>
-
computedOnClientStored
Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.STORED
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
any ofGeneratorStatementType.INSERT
orGeneratorStatementType.UPDATE
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStored
in interfaceDataType<T>
-
computedOnClientStoredOn
Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.STORED
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the argumentstatementType
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.computedOnClientStoredOn(GeneratorStatementType, Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredOn
in interfaceDataType<T>
-
computedOnClientStoredOn
public final boolean computedOnClientStoredOn(GeneratorStatementType statementType, Configuration configuration) Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.STORED
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the argumentstatementType
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredOn
in interfaceDataType<T>
-
computedOnClientVirtual
public final boolean computedOnClientVirtual()Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.VIRTUAL
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the typeGeneratorStatementType.SELECT
This method returns the static information for this data type. The information may be overridden by a
Settings
value, e.g.Settings.isEmulateComputedColumns()
, in case of whichDataType.computedOnClientVirtual(Configuration)
should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientVirtual
in interfaceDataType<T>
-
computedOnClientVirtual
Description copied from interface:DataType
Whether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()
DataType.generationLocation()
==QOM.GenerationLocation.CLIENT
DataType.generationOption()
==QOM.GenerationOption.VIRTUAL
DataType.generatedAlwaysAsGenerator()
produces a generator thatGenerator.supports(GeneratorStatementType)
the typeGeneratorStatementType.SELECT
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientVirtual
in interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataType
Set the computed column expression of this data type to a constant value.This implicitly sets
DataType.readonly()
totrue
.This feature is implemented in commercial distributions only.
- Specified by:
generatedAlwaysAs
in interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataType
Set the computed column expression of this data type to a constant expression.This implicitly sets
DataType.readonly()
totrue
.This feature is implemented in commercial distributions only.
- Specified by:
generatedAlwaysAs
in interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataType
Get the computed column expression of this data type, if any.This eagerly evaluates the
DataType.generatedAlwaysAsGenerator()
generator, which may not produce the same expression upon execution of a query, in caseDataType.generationLocation()
isQOM.GenerationLocation.CLIENT
. The behaviour ofQOM.GenerationLocation.SERVER
is not affected. The method has been left unmodified for backwards compatibility with jOOQ 3.16.This feature is implemented in commercial distributions only.
- Specified by:
generatedAlwaysAs
in interfaceDataType<T>
-
stored
Description copied from interface:DataType
Set theDataType.generationOption()
of the computed column expression toQOM.GenerationOption.STORED
.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
-
virtual
Description copied from interface:DataType
Set theDataType.generationOption()
of the computed column expression toQOM.GenerationOption.VIRTUAL
.If not supported by the dialect, this will be ignored.
This feature is implemented in commercial distributions only.
-
autoIncrement
Description copied from interface:DataType
Return a new data type like this, with theDataType.identity(boolean)
flag set totrue
.[#5709] The IDENTITY flag imposes a NOT NULL constraint, and removes all DEFAULT values.
This is the same as calling
identity(true)
.- Specified by:
autoIncrement
in interfaceDataType<T>
- Returns:
- The new data type
-
generatedByDefaultAsIdentity
Description copied from interface:DataType
Return a new data type like this, with theDataType.identity(boolean)
flag set totrue
.[#5709] The IDENTITY flag imposes a NOT NULL constraint, and removes all DEFAULT values.
This is the same as calling
identity(true)
.- Specified by:
generatedByDefaultAsIdentity
in interfaceDataType<T>
- Returns:
- The new data type
-
defaultValue
Description copied from interface:DataType
Specify an expression to be applied as theDEFAULT
value for this data type.[#5709] A
defaulted
column cannot have anDataType.identity()
.This is an alias for
DataType.default_(Object)
.- Specified by:
defaultValue
in interfaceDataType<T>
- See Also:
-
defaultValue
Description copied from interface:DataType
Specify an expression to be applied as theDEFAULT
value 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
DEFAULT
expressions is defined by the underlying database. Please refer to your database manual to learn what expressions are possible.This is an alias for
DataType.default_(Field)
.- Specified by:
defaultValue
in interfaceDataType<T>
-
defaultValue
Description copied from interface:DataType
The expression to be applied as theDEFAULT
value for this data type.This is an alias for
DataType.default_()
.- Specified by:
defaultValue
in interfaceDataType<T>
- Returns:
- The default value if present, or
null
if no default value is specified for this data type. - See Also:
-
default_
Description copied from interface:DataType
Specify an expression to be applied as theDEFAULT
value for this data type.[#5709] A
defaulted
column cannot have anDataType.identity()
. -
defaulted
public final boolean defaulted()Description copied from interface:DataType
Get the defaultability of this data type. -
precision
public final int precision()Description copied from interface:DataType
Get the precision of this data type. -
precision
Description copied from interface:DataType
Return a new data type like this, with a new precision value.This will have no effect if
DataType.hasPrecision()
isfalse
This is the same as calling
DataType.precision(int, int)
withscale == 0
-
precision
Description copied from interface:DataType
Return a new data type like this, with a new precision and scale value.This will have no effect if
DataType.hasPrecision()
isfalse
, or ifscale > 0
andDataType.hasScale()
isfalse
-
hasPrecision
public final boolean hasPrecision()Description copied from interface:DataType
Whether this data type has a precision.- Specified by:
hasPrecision
in interfaceDataType<T>
- Returns:
- Whether this data type has a precision
-
precisionDefined
public final boolean precisionDefined()Description copied from interface:DataType
Whether the precision returned byDataType.precision()
is defined.The default precision is
0
for all data types. If a data type does not have a precision (seeDataType.hasPrecision()
), or if it was initialised without precision (e.g.SQLDataType.TIMESTAMP
), then the precision is not defined.- Specified by:
precisionDefined
in interfaceDataType<T>
-
scale
public final int scale()Description copied from interface:DataType
Get the scale of this data type. -
scale
Description copied from interface:DataType
Return a new data type like this, with a new scale value.This will have no effect if
DataType.hasScale()
isfalse
-
hasScale
public final boolean hasScale()Description copied from interface:DataType
Whether this data type has a scale. -
scaleDefined
public final boolean scaleDefined()Description copied from interface:DataType
Whether the precision returned byDataType.scale()
is defined.The default scale is
0
for all data types. If a data type does not have a scale (seeDataType.hasScale()
), or if it was initialised without scale (e.g.SQLDataType.TIMESTAMP
), then the scale is not defined.- Specified by:
scaleDefined
in interfaceDataType<T>
-
length
Description copied from interface:DataType
Return a new data type like this, with a new length value.This will have no effect if
DataType.hasLength()
isfalse
-
length
public final int length()Description copied from interface:DataType
Get the length of this data type. -
hasLength
public final boolean hasLength()Description copied from interface:DataType
Whether this data type has a length. -
hasFixedLength
public final boolean hasFixedLength()Description copied from interface:DataType
Whether this data type has a fixed length.- Specified by:
hasFixedLength
in interfaceDataType<T>
- Returns:
- Whether this data type has a fixed length
-
lengthDefined
public final boolean lengthDefined()Description copied from interface:DataType
Whether the precision returned byDataType.length()
is defined.The default length is
0
for all data types. If a data type does not have a length (seeDataType.hasLength()
), or if it was initialised without length (e.g.SQLDataType.TIMESTAMP
), then the length is not defined.- Specified by:
lengthDefined
in interfaceDataType<T>
-
getSQLType
public int getSQLType()Description copied from interface:DataType
Get JDBCTypes
value.- Specified by:
getSQLType
in interfaceDataType<T>
-
getSQLType
Description copied from interface:DataType
Get the dialect-specific JDBCTypes
value.- Specified by:
getSQLType
in interfaceDataType<T>
-
getDomain
Description copied from interface:DataType
Get the defining DOMAIN type orNULL
if there is no such type. -
getConverter
Description copied from interface:DataType
Get the converter associated with this data type.- Specified by:
getConverter
in interfaceDataType<T>
-
getTypeName
Description copied from interface:DataType
Retrieve the dialect-specific type name associated with this data type.- Specified by:
getTypeName
in interfaceDataType<T>
-
getTypeName
Description copied from interface:DataType
Retrieve the dialect-specific type name associated with this data type.- Specified by:
getTypeName
in interfaceDataType<T>
-
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 interfaceDataType<T>
-
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 interfaceDataType<T>
-
getArrayType
Description copied from interface:DataType
Retrieve the Java type associated with ARRAYs of this data type.- Specified by:
getArrayType
in interfaceDataType<T>
-
getArrayDataType
Description copied from interface:DataType
Retrieve the data type for an ARRAY of this data type.Built-in data types, as well as custom data types that have a custom
DataType.getConverter()
can be translated to array data types usingConverter.forArrays()
. Data types with customDataType.getBinding()
cannot be translated to an array data type. Use this idiom, instead:// Doesn't work DataTypeinvalid input: '<'UserType[]> t1 = SQLDataType.INTEGER.asConvertedDataType(binding).getArrayDataType(); // Works DataTypeinvalid input: '<'UserType[]> t2 = SQLDataType.INTEGER.getArrayDataType().asConvertedDataType(arrayBinding);
- Specified by:
getArrayDataType
in interfaceDataType<T>
-
array
Description copied from interface:DataType
A convenient short for formDataType.getArrayDataType()
for DSL usage -
getArrayComponentType
Description copied from interface:DataType
Retrieve the Java component type if this is an ARRAY type, ornull
, otherwise.E.g. for
DataTypeinvalid input: '<'String[][][]>
, this will returnString[][]
.- Specified by:
getArrayComponentType
in interfaceDataType<T>
-
getArrayComponentDataType
Description copied from interface:DataType
Retrieve the Java component data type if this is an ARRAY type, ornull
, otherwise.E.g. for
DataTypeinvalid input: '<'String[][][]>
, this will returnDataType<String[][]>
.- Specified by:
getArrayComponentDataType
in interfaceDataType<T>
-
getArrayBaseType
Description copied from interface:DataType
Retrieve the Java base type if this is an ARRAY type, orDataType.getType()
, otherwise.E.g. for
DataTypeinvalid input: '<'String[][][]>
, this will returnString
.- Specified by:
getArrayBaseType
in interfaceDataType<T>
-
getArrayBaseDataType
Description copied from interface:DataType
Retrieve the Java component data type if this is an ARRAY type, orthis
, otherwise.E.g. for
DataTypeinvalid input: '<'String[][][]>
, this will returnDataType<String>
.- Specified by:
getArrayBaseDataType
in interfaceDataType<T>
-
getRow
Description copied from interface:DataType
Get the nested record'sRow
definition, if this is aDataType.isRecord()
, or aDataType.isMultiset()
, orNULL
otherwise. -
getRecordType
Description copied from interface:DataType
Get the nested record's record type definition, if this is aDataType.isRecord()
, or aDataType.isMultiset()
, orNULL
otherwise.- Specified by:
getRecordType
in interfaceDataType<T>
-
asArrayDataType
Description copied from interface:DataType
Retrieve the data type for an Oracle-style ARRAY of this data type.- Specified by:
asArrayDataType
in interfaceDataType<T>
-
asAssociativeArrayDataType
@Pro public final <A extends AssociativeArrayRecord<?,?>> DataType<A> asAssociativeArrayDataType(Class<A> arrayDataType) Description copied from interface:DataType
Retrieve the data type for an Oracle-style associative array of this data type.- Specified by:
asAssociativeArrayDataType
in interfaceDataType<T>
-
asEnumDataType
Description copied from interface:DataType
Retrieve the data type for a given enum data type.- Specified by:
asEnumDataType
in interfaceDataType<T>
-
asConvertedDataType
Description copied from interface:DataType
Retrieve the data type for a given converter.- Specified by:
asConvertedDataType
in interfaceDataType<T>
-
asConvertedDataType
Description copied from interface:DataType
Retrieve the data type for a given binding.- Specified by:
asConvertedDataType
in interfaceDataType<T>
-
convert
Description copied from interface:DataType
Convert an arbitrary object into<T>
.See
invalid reference
Convert#convert(Object, Class)
Configuration.converterProvider()
. -
convert
Description copied from interface:DataType
Convert an arbitrary set of objects into<T>
.See
invalid reference
Convert#convert(Object, Class)
Configuration.converterProvider()
. -
convert
Description copied from interface:DataType
Convert an arbitrary set of objects into<T>
.See
invalid reference
Convert#convert(Object, Class)
Configuration.converterProvider()
. -
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:
-
isDecimal
public final boolean isDecimal()Description copied from interface:DataType
Whether this data type is any decimal numeric data type.This applies to any of these types:
-
isInteger
public final boolean isInteger()Description copied from interface:DataType
Whether this data type is any integer data type.This applies to any of these types:
-
isFloat
public final boolean isFloat()Description copied from interface:DataType
Whether this data type is any floating point data type.This applies to any of these types:
-
isBoolean
public final boolean isBoolean()Description copied from interface:DataType
Whether this data type is any boolean data type.This applies to any of these types:
-
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:
-
isNString
public final boolean isNString()Description copied from interface:DataType
Whether this data type is any national character data type.This applies to any of these types:
-
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 interfaceDataType<T>
- See Also:
-
isDate
public final boolean isDate()Description copied from interface:DataType
Whether this data type is any date type.This applies to any of these types.
-
isTimestamp
public final boolean isTimestamp()Description copied from interface:DataType
Whether this data type is any timestamp type.This applies to any of these types.
- Specified by:
isTimestamp
in interfaceDataType<T>
-
isTimestampWithTimeZone
public final boolean isTimestampWithTimeZone()Description copied from interface:DataType
Whether this data type is any timestamp type.This applies to any of these types.
- Specified by:
isTimestampWithTimeZone
in interfaceDataType<T>
-
isTime
public final boolean isTime()Description copied from interface:DataType
Whether this data type is any time type.This applies to any of these types.
-
isTimeWithTimeZone
public final boolean isTimeWithTimeZone()Description copied from interface:DataType
Whether this data type is any time type.This applies to any of these types.
- Specified by:
isTimeWithTimeZone
in interfaceDataType<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.
-
SQLDataType.DATE
-
SQLDataType.TIME
-
SQLDataType.TIMESTAMP
-
SQLDataType.LOCALDATE
-
SQLDataType.LOCALTIME
-
SQLDataType.LOCALDATETIME
-
SQLDataType.OFFSETTIME
-
SQLDataType.OFFSETDATETIME
-
SQLDataType.INSTANT
-
SQLDataType.YEAR
-
YearToSecond
-
YearToMonth
-
DayToSecond
This is a combination of
DataType.isDateTime()
orDataType.isInterval()
- Specified by:
isTemporal
in interfaceDataType<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 interfaceDataType<T>
-
isLob
public final boolean isLob()Description copied from interface:DataType
Whether this data type is best deserialised as aLOB
.This applies to any of these types.
-
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.
-
isArray
public final boolean isArray()Description copied from interface:DataType
Whether this data type is an array type. -
isAssociativeArray
public final boolean isAssociativeArray()Description copied from interface:DataType
Whether this data type is an array type.- Specified by:
isAssociativeArray
in interfaceDataType<T>
-
isEmbeddable
public final boolean isEmbeddable()Description copied from interface:DataType
Whether this data type is an embeddable type.- Specified by:
isEmbeddable
in interfaceDataType<T>
-
isUDT
public final boolean isUDT()Description copied from interface:DataType
Whether this data type is a UDT type. -
isRecord
public boolean isRecord()Description copied from interface:DataType
Whether this data type is a nested record type.This is true for anonymous, structural nested record types constructed with
DSL.row(SelectField...)
or for nominal nested record types, such asDataType.isUDT()
orDataType.isEmbeddable()
. -
isMultiset
public boolean isMultiset()Description copied from interface:DataType
Whether this data type is a nested collection type.This is true for anonymous, structural nested collection types constructed with
DSL.multiset(TableLike)
orDSL.multisetAgg(Field...)
.- Specified by:
isMultiset
in interfaceDataType<T>
-
isEnum
public final boolean isEnum()Description copied from interface:DataType
Whether this data type is an enum type. -
isJSON
public final boolean isJSON()Description copied from interface:DataType
Whether this data type is a JSON type. -
isXML
public final boolean isXML()Description copied from interface:DataType
Whether this data type is an XML type. -
isSpatial
public final boolean isSpatial()Description copied from interface:DataType
Whether this data type is a spatial type. -
isUUID
public final boolean isUUID()Description copied from interface:DataType
Whether this data type is a UUID type. -
isOther
public final boolean isOther()Description copied from interface:DataType
Whether this data type is an OTHER type.The
SQLDataType.OTHER
type maps any unknown data types to a jOOQDataType
. This includes unknown vendor specific types as well as unknown user defined types which do not have any customConverter
orBinding
attached. The type may still be usable with the jOOQ API, but jOOQ's behaviour may not be well defined. Please note that any future minor release may add support for a vendor specific type, meaning the type loses its "otherness." -
accept
Description copied from interface:QueryPartInternal
ThisQueryPart
canaccept
aContext
object in order to render a SQL string or to bind its variables.- Specified by:
accept
in interfaceQueryPartInternal
-
toString
Description copied from interface:QueryPart
Render a SQL string representation of thisQueryPart
.For improved debugging, this renders a SQL string of this
QueryPart
with inlined bind variables. If thisQueryPart
isAttachable
, then the attachedConfiguration
may be used for rendering the SQL string, includingSQLDialect
andSettings
. Do note that mostQueryPart
instances are not attached to aConfiguration
, and thus there is no guarantee that the SQL string will make sense in the context of a specific database. -
hashCode
public int hashCode()Description copied from interface:QueryPart
Generate a hash code from thisQueryPart
.In general,
QueryPart
hash codes are the same as the hash codes generated fromQueryPart.toString()
. This guarantees consistent behaviour withQueryPart.equals(Object)
Some
QueryPart
implementations may choose to override this behaviour for improved performance, asQueryPart.toString()
is an expensive operation, if called many times. -
equals
Description copied from interface:QueryPart
Check whether thisQueryPart
can be considered equal to anotherQueryPart
.In general,
QueryPart
equality is defined in terms ofQueryPart.toString()
equality. In other words, two query parts are considered equal if their rendered SQL (with inlined bind variables) is equal. This means that the two query parts do not necessarily have to be of the same type.Some
QueryPart
implementations may choose to override this behaviour for improved performance, asQueryPart.toString()
is an expensive operation, if called many times. -
$traverse
Description copied from interface:QueryPart
Traverser thisQueryPart
expression tree using a composableTraverser
, producing a result.This offers a generic way to traverse expression trees to translate the tree to arbitrary other data structures. The simplest traversal would just count all the tree elements:
int count = CUSTOMER.NAME.eq(1).$traverse(0, (i, p) -> i + 1);
The same can be achieved by translating the JDK
Collector
API to theTraverser
API usingTraversers.collecting(Collector)
.CUSTOMER.NAME.eq(1).$traverse(Traversers.collecting(Collectors.counting()));
Unlike a
Collector
, aTraverser
is optimised for tree traversal, not stream traversal:- Is not designed for parallelism
- It can
Traverser.abort()
traversal early when the result can be produced early (e.g. when runningTraversers.containing(QueryPart)
, and a result has been found). - It can decide whether to
Traverser.recurse()
into aQueryPart
subtree, or whether that is not necessary or even undesirable, e.g. to prevent entering new subquery scopes. - Unlike a Collector, which can use its
Collector.accumulator()
to accumulate each element only once, in tree traversal, it's desirable to be able to distinguish between accumulating an itemTraverser.before()
orTraverser.after()
recursing into it. This is useful e.g. to wrap each tree node in XML opening and closing tags.
This is a commercial jOOQ edition only feature.
-
$replace
Description copied from interface:QueryPart
-
getName
Description copied from interface:Named
The unqualified name of this object. -
getQualifiedName
Description copied from interface:Named
The qualified name of this object.- Specified by:
getQualifiedName
in interfaceNamed
-
getUnqualifiedName
Description copied from interface:Named
The unqualified name of this object.- Specified by:
getUnqualifiedName
in interfaceNamed
-
getComment
Description copied from interface:Named
The comment on this object.This is the same as calling
Named.getCommentPart()
and thenComment.getComment()
.- Specified by:
getComment
in interfaceNamed
-
getCommentPart
Description copied from interface:Named
The comment on this object as aQueryPart
.- Specified by:
getCommentPart
in interfaceNamed
-
$name
Description copied from interface:Named
Experimental query object model accessor method, see alsoQOM
. Subject to change in future jOOQ versions, use at your own risk. -
clauses
Deprecated.- 3.11.0 - [#8179] - This functionality will be removed in the future.Description copied from interface:QueryPartInternal
TheClause
s that are represented by this query part.QueryPart
s can specify severalClause
s for which an event will be emittedbefore
(in forward order) andafter
(in reverse order) visiting the the query part throughContext.visit(QueryPart)
This method is for JOOQ INTERNAL USE only. Do not reference directly
- Specified by:
clauses
in interfaceQueryPartInternal
- Returns:
- The
Clause
s represented by this query part ornull
or an empty array if this query part does not represent a clause.
-
rendersContent
Subclasses may override this- Specified by:
rendersContent
in interfaceQueryPartInternal
-
declaresFields
public boolean declaresFields()Subclasses may override this- Specified by:
declaresFields
in interfaceQueryPartInternal
-
declaresTables
public boolean declaresTables()Subclasses may override this- Specified by:
declaresTables
in interfaceQueryPartInternal
-
declaresWindows
public boolean declaresWindows()Subclasses may override this- Specified by:
declaresWindows
in interfaceQueryPartInternal
-
declaresCTE
public boolean declaresCTE()Subclasses may override this- Specified by:
declaresCTE
in interfaceQueryPartInternal
-
declaresParameters
Subclasses may override this- Specified by:
declaresParameters
in interfaceQueryPartInternal
-
generatesCast
public boolean generatesCast()Subclasses may override this- Specified by:
generatesCast
in interfaceQueryPartInternal
-
create
Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.Internal convenience method -
create
Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.Internal convenience method -
create
Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()
andConfiguration.dsl()
instead.Internal convenience method -
translate
Internal convenience method
-