- 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
ConstructorsConstructorDescriptionBuiltInDataType(Class<T> type, String typeName) Constructor forSQLDataTypetypes.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 QueryPartTraverse aQueryParthierarchy and recursively replace its elements by alternatives.default <R> Rfinal voidarray()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 booleancomputed()Whether this column is computed.final booleanWhether this column is computed on the client.final booleancomputedOnClient(Configuration configuration) Whether this column is computed on the client.final booleanWhether this column is computed on the client.final booleancomputedOnClientStored(Configuration configuration) Whether this column is computed on the client.final booleancomputedOnClientStoredOn(GeneratorStatementType statementType) Whether this column is computed on the client.final booleancomputedOnClientStoredOn(GeneratorStatementType statementType, Configuration configuration) Whether this column is computed on the client.final booleanWhether this column is computed on the client.final booleancomputedOnClientVirtual(Configuration configuration) Whether this column is computed on the client.final booleanWhether this column is computed on the server.final booleancomputedOnServer(Configuration configuration) Whether this column is computed on the server.final TConvert 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 DSLContextcreate()Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()andConfiguration.dsl()instead.protected final DSLContextcreate(Configuration configuration) Deprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()andConfiguration.dsl()instead.protected final DSLContextDeprecated.- 3.11.0 - [#6722] - UseAttachable.configuration()andConfiguration.dsl()instead.booleanSubclasses may override thisbooleanSubclasses may override thisbooleanSubclasses may override thisbooleanSubclasses may override thisbooleanSubclasses may override thisSpecify an expression to be applied as theDEFAULTvalue for this data type.Specify an expression to be applied as theDEFAULTvalue for this data type.final booleanGet the defaultability of this data type.The expression to be applied as theDEFAULTvalue for this data type.defaultValue(Field<T> d) Specify an expression to be applied as theDEFAULTvalue for this data type.defaultValue(T d) Specify an expression to be applied as theDEFAULTvalue for this data type.booleanCheck whether thisQueryPartcan 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.booleanSubclasses 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 StringThe comment on this object.final CommentThe comment on this object as aQueryPart.final ContextConverter<?, T> Get the converter associated with this data type.Get the defining DOMAIN type orNULLif there is no such type.final Class<?> TheConverter.fromType()(or database type) in case thisDataTypehas a converter.final StringgetName()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(), orNULLotherwise.getRow()Get the nested record'sRowdefinition, if this is aDataType.isRecord(), or aDataType.isMultiset(), orNULLotherwise.intGet JDBCTypesvalue.final intgetSQLType(Configuration configuration) Get the dialect-specific JDBCTypesvalue.TheConverter.toType()(or user type) in case thisDataTypehas a converter.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 NameThe unqualified name of this object.final booleanWhether this data type has a fixed length.inthashCode()Generate a hash code from thisQueryPart.final booleanWhether this data type has a length.final booleanWhether this data type has a precision.final booleanhasScale()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 booleanisArray()Whether this data type is an array type.final booleanWhether this data type is an array type.final booleanisBinary()Whether this data type is any binary type.final booleanWhether this data type is any boolean data type.final booleanisDate()Whether this data type is any date type.final booleanWhether this data type is any date or time type.final booleanWhether this data type is any decimal numeric data type.final booleanWhether this data type is an embeddable type.final booleanisEnum()Whether this data type is an enum type.final booleanisFloat()Whether this data type is any floating point data type.final booleanWhether this data type is any integer data type.final booleanWhether this data type is any interval type.final booleanisJSON()Whether this data type is a JSON type.final booleanisLob()Whether this data type is best deserialised as aLOB.booleanWhether this data type is a nested collection type.final booleanWhether this data type is any national character data type.final booleanWhether this data type is any numeric data type.final booleanisOther()Whether this data type is an OTHER type.final booleanWhether this data type is aQualifiedRecordtype.booleanisRecord()Whether this data type is a nested record type.final booleanisRowId()Whether this data type is aRowIdtype.final booleanWhether this data type is a spatial type.final booleanisString()Whether this data type is any character data type.final booleanWhether this data type is any date or time type.final booleanisTime()Whether this data type is any time type.final booleanWhether this data type is any timestamp type.final booleanWhether this data type is any timestamp type.final booleanWhether this data type is any time type.final booleanisUDT()Whether this data type is a UDT type.final booleanWhether this data type is aUDTRecordtype.final booleanisUUID()Whether this data type is a UUID type.final booleanisXML()Whether this data type is an XML type.final intlength()Get the length of this data type.length(int l) Return a new data type like this, with a new length value.final booleanWhether the precision returned byDataType.length()is defined.notNull()Synonym forDataType.nullable(boolean), passingfalseas an argument.null_()Synonym forDataType.nullable(boolean), passingtrueas an argument.Return a new data type like this, with a new nullability.final booleannullable()Get the nullability of this data type.nullable(boolean n) Return a new data type like this, with a new nullability.final intGet 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 booleanWhether the precision returned byDataType.precision()is defined.readonly(boolean r) Return a new data type like this, with a new readonly attribute.final booleanGet the readonly attribute of this data type, combined with other flags that influence readonly behaviour.final booleanreadonlyInternal(Configuration configuration) Get the readonly attribute of this data type, combined with other flags that influence readonly behaviour.booleanrendersContent(Context<?> ctx) Subclasses may override thisfinal intscale()Get the scale of this data type.scale(int s) Return a new data type like this, with a new scale value.final booleanWhether 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 DataAccessExceptiontranslate(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, readonlyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jooq.DataType
asConvertedDataType, asConvertedDataTypeFrom, asConvertedDataTypeFrom, asConvertedDataTypeTo, asConvertedDataTypeToMethods inherited from interface org.jooq.Named
$name, getComment, getCommentPart, getName, getQualifiedName, getUnqualifiedName
-
Constructor Details
-
BuiltInDataType
Constructor forSQLDataTypetypes. -
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:DataTypeReturn a new data type like this, with a new nullability.[#5709] A
nullablecolumn cannot have anDataType.identity().- Specified by:
nullabilityin interfaceDataType<T>- Parameters:
n- The new nullability- Returns:
- The new data type
-
readonly
Description copied from interface:DataTypeReturn a new data type like this, with a new readonly attribute.This feature is implemented in commercial distributions only.
-
generatedAlwaysAs
Description copied from interface:DataTypeSet 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:
generatedAlwaysAsin interfaceDataType<T>
-
generationOption
Description copied from interface:DataTypeSet 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:
generationOptionin interfaceDataType<T>
-
generationLocation
Description copied from interface:DataTypeSet 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, orMergestatements in caseDataType.generationOption()isQOM.GenerationOption.STORED, or inSelectin case theDataType.generationOption()isQOM.GenerationOption.VIRTUAL.This feature is implemented in commercial distributions only.
- Specified by:
generationLocationin interfaceDataType<T>
-
collation
Description copied from interface:DataTypeReturn a new data type like this, with a new collation. -
characterSet
Description copied from interface:DataTypeReturn a new data type like this, with a new character set.- Specified by:
characterSetin interfaceDataType<T>
-
identity
Description copied from interface:DataTypeReturn 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:DataTypeSpecify 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 TABLEALTER 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. -
nullable
Description copied from interface:DataTypeReturn a new data type like this, with a new nullability.This is the same as calling
DataType.nullability(Nullability)with any ofNullability.NULLorNullability.NOT_NULLas an argument.[#5709] A
nullablecolumn cannot have anDataType.identity(). -
nullable
public final boolean nullable()Description copied from interface:DataTypeGet the nullability of this data type.This returns
trueby default, i.e. ifDataType.nullability()isNullability.DEFAULT. -
null_
Description copied from interface:DataTypeSynonym forDataType.nullable(boolean), passingtrueas an argument. -
notNull
Description copied from interface:DataTypeSynonym forDataType.nullable(boolean), passingfalseas an argument. -
readonlyInternal
public final boolean readonlyInternal()Description copied from interface:DataTypeGet 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.SERVERor withQOM.GenerationLocation.CLIENTandQOM.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.CLIENTandQOM.GenerationOption.STORED - Columns used for optimistic locking
This method returns the static information for this data type. The information may be overridden by a
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.readonlyInternal(Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
readonlyInternalin interfaceDataType<T>
-
readonlyInternal
Description copied from interface:DataTypeGet 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.SERVERor withQOM.GenerationLocation.CLIENTandQOM.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.CLIENTandQOM.GenerationOption.STORED - Columns used for optimistic locking
This feature is implemented in commercial distributions only.
- Specified by:
readonlyInternalin interfaceDataType<T>
-
computed
public final boolean computed()Description copied from interface:DataTypeWhether this column is computed.This feature is implemented in commercial distributions only.
-
computedOnServer
public final boolean computedOnServer()Description copied from interface:DataTypeWhether 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
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.computedOnServer(Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnServerin interfaceDataType<T>
-
computedOnServer
Description copied from interface:DataTypeWhether 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:
computedOnServerin interfaceDataType<T>
-
computedOnClient
public final boolean computedOnClient()Description copied from interface:DataTypeWhether 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
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.computedOnClient(Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientin interfaceDataType<T>
-
computedOnClient
Description copied from interface:DataTypeWhether 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:
computedOnClientin interfaceDataType<T>
-
computedOnClientStored
public final boolean computedOnClientStored()Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.STOREDDataType.generatedAlwaysAsGenerator()produces a generator thatGenerator.supports(GeneratorStatementType)any ofGeneratorStatementType.INSERTorGeneratorStatementType.UPDATE
This method returns the static information for this data type. The information may be overridden by a
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.computedOnClientStored(Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredin interfaceDataType<T>
-
computedOnClientStored
Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.STOREDDataType.generatedAlwaysAsGenerator()produces a generator thatGenerator.supports(GeneratorStatementType)any ofGeneratorStatementType.INSERTorGeneratorStatementType.UPDATE
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredin interfaceDataType<T>
-
computedOnClientStoredOn
Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.STOREDDataType.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
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.computedOnClientStoredOn(GeneratorStatementType, Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredOnin interfaceDataType<T>
-
computedOnClientStoredOn
public final boolean computedOnClientStoredOn(GeneratorStatementType statementType, Configuration configuration) Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.STOREDDataType.generatedAlwaysAsGenerator()produces a generator thatGenerator.supports(GeneratorStatementType)the argumentstatementType
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientStoredOnin interfaceDataType<T>
-
computedOnClientVirtual
public final boolean computedOnClientVirtual()Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.VIRTUALDataType.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
Settingsvalue, e.g.Settings.isEmulateComputedColumns(), in case of whichDataType.computedOnClientVirtual(Configuration)should be called.This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientVirtualin interfaceDataType<T>
-
computedOnClientVirtual
Description copied from interface:DataTypeWhether this column is computed on the client.This is true only if all of these hold true:
DataType.computed()DataType.generationLocation()==QOM.GenerationLocation.CLIENTDataType.generationOption()==QOM.GenerationOption.VIRTUALDataType.generatedAlwaysAsGenerator()produces a generator thatGenerator.supports(GeneratorStatementType)the typeGeneratorStatementType.SELECT
This feature is implemented in commercial distributions only.
- Specified by:
computedOnClientVirtualin interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataTypeSet 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:
generatedAlwaysAsin interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataTypeSet 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:
generatedAlwaysAsin interfaceDataType<T>
-
generatedAlwaysAs
Description copied from interface:DataTypeGet 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.SERVERis 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:
generatedAlwaysAsin interfaceDataType<T>
-
stored
Description copied from interface:DataTypeSet 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:DataTypeSet 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:DataTypeReturn 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:
autoIncrementin interfaceDataType<T>- Returns:
- The new data type
-
generatedByDefaultAsIdentity
Description copied from interface:DataTypeReturn 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:
generatedByDefaultAsIdentityin interfaceDataType<T>- Returns:
- The new data type
-
defaultValue
Description copied from interface:DataTypeSpecify an expression to be applied as theDEFAULTvalue for this data type.[#5709] A
defaultedcolumn cannot have anDataType.identity().This is an alias for
DataType.default_(Object).- Specified by:
defaultValuein interfaceDataType<T>- See Also:
-
defaultValue
Description copied from interface:DataTypeSpecify 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 TABLEALTER 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
DataType.default_(Field).- Specified by:
defaultValuein interfaceDataType<T>
-
defaultValue
Description copied from interface:DataTypeThe expression to be applied as theDEFAULTvalue for this data type.This is an alias for
DataType.default_().- Specified by:
defaultValuein interfaceDataType<T>- Returns:
- The default value if present, or
nullif no default value is specified for this data type. - See Also:
-
default_
Description copied from interface:DataTypeSpecify an expression to be applied as theDEFAULTvalue for this data type.[#5709] A
defaultedcolumn cannot have anDataType.identity(). -
defaulted
public final boolean defaulted()Description copied from interface:DataTypeGet the defaultability of this data type. -
precision
public final int precision()Description copied from interface:DataTypeGet the precision of this data type. -
precision
Description copied from interface:DataTypeReturn a new data type like this, with a new precision value.This will have no effect if
DataType.hasPrecision()isfalseThis is the same as calling
DataType.precision(int, int)withscale == 0 -
precision
Description copied from interface:DataTypeReturn a new data type like this, with a new precision and scale value.This will have no effect if
DataType.hasPrecision()isfalse, or ifscale > 0andDataType.hasScale()isfalse -
hasPrecision
public final boolean hasPrecision()Description copied from interface:DataTypeWhether this data type has a precision.- Specified by:
hasPrecisionin interfaceDataType<T>- Returns:
- Whether this data type has a precision
-
precisionDefined
public final boolean precisionDefined()Description copied from interface:DataTypeWhether the precision returned byDataType.precision()is defined.The default precision is
0for 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:
precisionDefinedin interfaceDataType<T>
-
scale
public final int scale()Description copied from interface:DataTypeGet the scale of this data type. -
scale
Description copied from interface:DataTypeReturn 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:DataTypeWhether this data type has a scale. -
scaleDefined
public final boolean scaleDefined()Description copied from interface:DataTypeWhether the precision returned byDataType.scale()is defined.The default scale is
0for 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:
scaleDefinedin interfaceDataType<T>
-
length
Description copied from interface:DataTypeReturn 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:DataTypeGet the length of this data type. -
hasLength
public final boolean hasLength()Description copied from interface:DataTypeWhether this data type has a length. -
hasFixedLength
public final boolean hasFixedLength()Description copied from interface:DataTypeWhether this data type has a fixed length.- Specified by:
hasFixedLengthin interfaceDataType<T>- Returns:
- Whether this data type has a fixed length
-
lengthDefined
public final boolean lengthDefined()Description copied from interface:DataTypeWhether the precision returned byDataType.length()is defined.The default length is
0for 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:
lengthDefinedin interfaceDataType<T>
-
getSQLType
public int getSQLType()Description copied from interface:DataTypeGet JDBCTypesvalue.- Specified by:
getSQLTypein interfaceDataType<T>
-
getSQLType
Description copied from interface:DataTypeGet the dialect-specific JDBCTypesvalue.- Specified by:
getSQLTypein interfaceDataType<T>
-
getDomain
Description copied from interface:DataTypeGet the defining DOMAIN type orNULLif there is no such type. -
getConverter
Description copied from interface:DataTypeGet the converter associated with this data type.- Specified by:
getConverterin interfaceDataType<T>
-
getFromType
Description copied from interface:DataTypeTheConverter.fromType()(or database type) in case thisDataTypehas a converter.- Specified by:
getFromTypein interfaceDataType<T>
-
getToType
Description copied from interface:DataTypeTheConverter.toType()(or user type) in case thisDataTypehas a converter. -
getTypeName
Description copied from interface:DataTypeRetrieve the dialect-specific type name associated with this data type.- Specified by:
getTypeNamein interfaceDataType<T>
-
getTypeName
Description copied from interface:DataTypeRetrieve the dialect-specific type name associated with this data type.- Specified by:
getTypeNamein interfaceDataType<T>
-
getCastTypeName
Description copied from interface:DataTypeRetrieve 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:
getCastTypeNamein interfaceDataType<T>
-
getCastTypeName
Description copied from interface:DataTypeRetrieve 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:
getCastTypeNamein interfaceDataType<T>
-
getArrayType
Description copied from interface:DataTypeRetrieve the Java type associated with ARRAYs of this data type.- Specified by:
getArrayTypein interfaceDataType<T>
-
getArrayDataType
Description copied from interface:DataTypeRetrieve 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 DataType<UserType[]> t1 = SQLDataType.INTEGER.asConvertedDataType(binding).getArrayDataType(); // Works DataType<UserType[]> t2 = SQLDataType.INTEGER.getArrayDataType().asConvertedDataType(arrayBinding);- Specified by:
getArrayDataTypein interfaceDataType<T>
-
array
Description copied from interface:DataTypeA convenient short for formDataType.getArrayDataType()for DSL usage -
getArrayComponentType
Description copied from interface:DataTypeRetrieve the Java component type if this is an ARRAY type, ornull, otherwise.E.g. for
DataType<String[][][]>, this will returnString[][].- Specified by:
getArrayComponentTypein interfaceDataType<T>
-
getArrayComponentDataType
Description copied from interface:DataTypeRetrieve the Java component data type if this is an ARRAY type, ornull, otherwise.E.g. for
DataType<String[][][]>, this will returnDataType<String[][]>.- Specified by:
getArrayComponentDataTypein interfaceDataType<T>
-
getArrayBaseType
Description copied from interface:DataTypeRetrieve the Java base type if this is an ARRAY type, orDataType.getType(), otherwise.E.g. for
DataType<String[][][]>, this will returnString.- Specified by:
getArrayBaseTypein interfaceDataType<T>
-
getArrayBaseDataType
Description copied from interface:DataTypeRetrieve the Java component data type if this is an ARRAY type, orthis, otherwise.E.g. for
DataType<String[][][]>, this will returnDataType<String>.- Specified by:
getArrayBaseDataTypein interfaceDataType<T>
-
getRow
Description copied from interface:DataTypeGet the nested record'sRowdefinition, if this is aDataType.isRecord(), or aDataType.isMultiset(), orNULLotherwise. -
getRecordType
Description copied from interface:DataTypeGet the nested record's record type definition, if this is aDataType.isRecord(), or aDataType.isMultiset(), orNULLotherwise.- Specified by:
getRecordTypein interfaceDataType<T>
-
asArrayDataType
Description copied from interface:DataTypeRetrieve the data type for an Oracle-style ARRAY of this data type.- Specified by:
asArrayDataTypein interfaceDataType<T>
-
asAssociativeArrayDataType
@Pro public final <A extends AssociativeArrayRecord<?,?>> DataType<A> asAssociativeArrayDataType(Class<A> arrayDataType) Description copied from interface:DataTypeRetrieve the data type for an Oracle-style associative array of this data type.- Specified by:
asAssociativeArrayDataTypein interfaceDataType<T>
-
asEnumDataType
Description copied from interface:DataTypeRetrieve the data type for a given enum data type.- Specified by:
asEnumDataTypein interfaceDataType<T>
-
asConvertedDataType
Description copied from interface:DataTypeRetrieve the data type for a given converter.- Specified by:
asConvertedDataTypein interfaceDataType<T>
-
asConvertedDataType
Description copied from interface:DataTypeRetrieve the data type for a given binding.- Specified by:
asConvertedDataTypein interfaceDataType<T>
-
convert
Description copied from interface:DataTypeConvert an arbitrary object into<T>.See
for details about conversion rules. Notice this does not pass through anyinvalid reference
Convert#convert(Object, Class)Configuration.converterProvider(). -
convert
Description copied from interface:DataTypeConvert an arbitrary set of objects into<T>.See
for details about conversion rules. Notice this does not pass through anyinvalid reference
Convert#convert(Object, Class)Configuration.converterProvider(). -
convert
Description copied from interface:DataTypeConvert an arbitrary set of objects into<T>.See
for details about conversion rules. Notice this does not pass through anyinvalid reference
Convert#convert(Object, Class)Configuration.converterProvider(). -
isNumeric
public final boolean isNumeric()Description copied from interface:DataTypeWhether this data type is any numeric data type.This applies to any of these types:
-
isDecimal
public final boolean isDecimal()Description copied from interface:DataTypeWhether 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:DataTypeWhether this data type is any integer data type.This applies to any of these types:
-
isFloat
public final boolean isFloat()Description copied from interface:DataTypeWhether 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:DataTypeWhether this data type is any boolean data type.This applies to any of these types:
-
isString
public final boolean isString()Description copied from interface:DataTypeWhether this data type is any character data type.This applies to any of these types:
-
isNString
public final boolean isNString()Description copied from interface:DataTypeWhether 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:DataTypeWhether this data type is any date or time type.This applies to any of these types.
- Specified by:
isDateTimein interfaceDataType<T>- See Also:
-
isDate
public final boolean isDate()Description copied from interface:DataTypeWhether this data type is any date type.This applies to any of these types.
-
isTimestamp
public final boolean isTimestamp()Description copied from interface:DataTypeWhether this data type is any timestamp type.This applies to any of these types.
- Specified by:
isTimestampin interfaceDataType<T>
-
isTimestampWithTimeZone
public final boolean isTimestampWithTimeZone()Description copied from interface:DataTypeWhether this data type is any timestamp type.This applies to any of these types.
- Specified by:
isTimestampWithTimeZonein interfaceDataType<T>
-
isTime
public final boolean isTime()Description copied from interface:DataTypeWhether this data type is any time type.This applies to any of these types.
-
isTimeWithTimeZone
public final boolean isTimeWithTimeZone()Description copied from interface:DataTypeWhether this data type is any time type.This applies to any of these types.
- Specified by:
isTimeWithTimeZonein interfaceDataType<T>
-
isTemporal
public final boolean isTemporal()Description copied from interface:DataTypeWhether 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:
isTemporalin interfaceDataType<T>
-
-
isInterval
public final boolean isInterval()Description copied from interface:DataTypeWhether this data type is any interval type.This applies to any of these types.
- Specified by:
isIntervalin interfaceDataType<T>
-
isLob
public final boolean isLob()Description copied from interface:DataTypeWhether this data type is best deserialised as aLOB.This applies to any of these types.
-
isBinary
public final boolean isBinary()Description copied from interface:DataTypeWhether this data type is any binary type.This applies to any of these types.
-
isArray
public final boolean isArray()Description copied from interface:DataTypeWhether this data type is an array type. -
isAssociativeArray
public final boolean isAssociativeArray()Description copied from interface:DataTypeWhether this data type is an array type.- Specified by:
isAssociativeArrayin interfaceDataType<T>
-
isEmbeddable
public final boolean isEmbeddable()Description copied from interface:DataTypeWhether this data type is an embeddable type.- Specified by:
isEmbeddablein interfaceDataType<T>
-
isUDTRecord
public final boolean isUDTRecord()Description copied from interface:DataTypeWhether this data type is aUDTRecordtype.- Specified by:
isUDTRecordin interfaceDataType<T>
-
isUDT
public final boolean isUDT()Description copied from interface:DataTypeWhether this data type is a UDT type.It is recommended to use
DataType.isQualifiedRecord()instead, which returns the same thing asDataType.isUDT(), orDataType.isUDTRecord()if only actualUDTtypes are requested. -
isQualifiedRecord
public final boolean isQualifiedRecord()Description copied from interface:DataTypeWhether this data type is aQualifiedRecordtype.This includes
RecordQualifier.getDataType()as well asRecordQualifier.getDataType().- Specified by:
isQualifiedRecordin interfaceDataType<T>
-
isRecord
public boolean isRecord()Description copied from interface:DataTypeWhether 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:DataTypeWhether 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:
isMultisetin interfaceDataType<T>
-
isEnum
public final boolean isEnum()Description copied from interface:DataTypeWhether this data type is an enum type. -
isJSON
public final boolean isJSON()Description copied from interface:DataTypeWhether this data type is a JSON type. -
isXML
public final boolean isXML()Description copied from interface:DataTypeWhether this data type is an XML type. -
isSpatial
public final boolean isSpatial()Description copied from interface:DataTypeWhether this data type is a spatial type. -
isRowId
public final boolean isRowId()Description copied from interface:DataTypeWhether this data type is aRowIdtype. -
isUUID
public final boolean isUUID()Description copied from interface:DataTypeWhether this data type is a UUID type. -
isOther
public final boolean isOther()Description copied from interface:DataTypeWhether this data type is an OTHER type.The
SQLDataType.OTHERtype 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 customConverterorBindingattached. 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:QueryPartInternalThisQueryPartcanacceptaContextobject in order to render a SQL string or to bind its variables.- Specified by:
acceptin interfaceQueryPartInternal
-
toString
Description copied from interface:QueryPartRender a SQL string representation of thisQueryPart.For improved debugging, this renders a SQL string of this
QueryPartwith inlined bind variables. If thisQueryPartisAttachable, then the attachedConfigurationmay be used for rendering the SQL string, includingSQLDialectandSettings. Do note that mostQueryPartinstances 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:QueryPartGenerate a hash code from thisQueryPart.In general,
QueryParthash codes are the same as the hash codes generated fromQueryPart.toString(). This guarantees consistent behaviour withQueryPart.equals(Object)Some
QueryPartimplementations may choose to override this behaviour for improved performance, asQueryPart.toString()is an expensive operation, if called many times. -
equals
Description copied from interface:QueryPartCheck whether thisQueryPartcan be considered equal to anotherQueryPart.In general,
QueryPartequality 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
QueryPartimplementations may choose to override this behaviour for improved performance, asQueryPart.toString()is an expensive operation, if called many times. -
$traverse
Description copied from interface:QueryPartTraverser thisQueryPartexpression 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
CollectorAPI to theTraverserAPI usingTraversers.collecting(Collector).CUSTOMER.NAME.eq(1).$traverse(Traversers.collecting(Collectors.counting()));Unlike a
Collector, aTraverseris 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 aQueryPartsubtree, 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:NamedThe unqualified name of this object. -
getQualifiedName
Description copied from interface:NamedThe qualified name of this object.- Specified by:
getQualifiedNamein interfaceNamed
-
getUnqualifiedName
Description copied from interface:NamedThe unqualified name of this object.- Specified by:
getUnqualifiedNamein interfaceNamed
-
getComment
Description copied from interface:NamedThe comment on this object.This is the same as calling
Named.getCommentPart()and thenComment.getComment().- Specified by:
getCommentin interfaceNamed
-
getCommentPart
Description copied from interface:NamedThe comment on this object as aQueryPart.- Specified by:
getCommentPartin interfaceNamed
-
$name
Description copied from interface:NamedExperimental 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:QueryPartInternalTheClauses that are represented by this query part.QueryParts can specify severalClauses 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:
clausesin interfaceQueryPartInternal- Returns:
- The
Clauses represented by this query part ornullor an empty array if this query part does not represent a clause.
-
rendersContent
Subclasses may override this- Specified by:
rendersContentin interfaceQueryPartInternal
-
declaresFields
public boolean declaresFields()Subclasses may override this- Specified by:
declaresFieldsin interfaceQueryPartInternal
-
declaresTables
public boolean declaresTables()Subclasses may override this- Specified by:
declaresTablesin interfaceQueryPartInternal
-
declaresWindows
public boolean declaresWindows()Subclasses may override this- Specified by:
declaresWindowsin interfaceQueryPartInternal
-
declaresCTE
public boolean declaresCTE()Subclasses may override this- Specified by:
declaresCTEin interfaceQueryPartInternal
-
declaresParameters
Subclasses may override this- Specified by:
declaresParametersin interfaceQueryPartInternal
-
generatesCast
public boolean generatesCast()Subclasses may override this- Specified by:
generatesCastin 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
-