public class DefaultDataType<T> extends java.lang.Object implements DataType<T>
This also acts as a static data type registry for jOOQ internally.
This type is for JOOQ INTERNAL USE only. Do not reference directly
Constructor and Description |
---|
DefaultDataType(SQLDialect dialect,
java.lang.Class<T> type,
java.lang.String typeName) |
DefaultDataType(SQLDialect dialect,
java.lang.Class<T> type,
java.lang.String typeName,
java.lang.String castTypeName) |
DefaultDataType(SQLDialect dialect,
DataType<T> sqlDataType,
java.lang.String typeName) |
DefaultDataType(SQLDialect dialect,
DataType<T> sqlDataType,
java.lang.String typeName,
java.lang.String castTypeName) |
Modifier and Type | Method and Description |
---|---|
<A extends ArrayRecord<?>> |
asArrayDataType(java.lang.Class<A> arrayDataType)
Retrieve the data type for an Oracle-style 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.
|
<E extends EnumType> |
asEnumDataType(java.lang.Class<E> enumDataType)
Retrieve the data type for a given enum data type.
|
java.util.List<T> |
convert(java.util.Collection<?> objects)
Convert an arbitrary set of objects into
<T> . |
T[] |
convert(java.lang.Object... objects)
Convert an arbitrary set of objects into
<T> . |
T |
convert(java.lang.Object object)
Convert an arbitrary object into
<T> . |
boolean |
defaulted()
Get the defaultability of this data type.
|
DataType<T> |
defaulted(boolean d)
Deprecated.
|
Field<T> |
defaultValue()
The expression to be applied as the
DEFAULT value for this
data type. |
DataType<T> |
defaultValue(Field<T> d)
Specify an expression to be applied as the
DEFAULT value for
this data type. |
DataType<T> |
defaultValue(T d)
Specify an expression to be applied as the
DEFAULT value for
this data type. |
boolean |
equals(java.lang.Object obj) |
DataType<T[]> |
getArrayDataType()
Retrieve the data type for an ARRAY of this data type.
|
java.lang.Class<T[]> |
getArrayType()
Retrieve the Java type associated with ARRAYs of this data type.
|
Binding<?,T> |
getBinding()
Get the data type binding associated with this data type.
|
java.lang.String |
getCastTypeName()
Retrieve the dialect-specific type name associated with this data type
used for casting.
|
java.lang.String |
getCastTypeName(Configuration configuration)
Retrieve the dialect-specific type name associated with this data type
used for casting.
|
Converter<?,T> |
getConverter()
Get the converter associated with this data type.
|
DataType<T> |
getDataType(Configuration configuration)
The dialect-specific data type representing this data type.
|
static <T> DataType<T> |
getDataType(SQLDialect dialect,
java.lang.Class<T> type) |
static <T> DataType<T> |
getDataType(SQLDialect dialect,
java.lang.Class<T> type,
DataType<T> fallbackDataType) |
static DataType<?> |
getDataType(SQLDialect dialect,
java.lang.String typeName) |
static DataType<?> |
getDataType(SQLDialect dialect,
java.lang.String t,
int p,
int s)
Convert a type name (using precision and scale) into a Java class
|
static DataType<java.lang.Object> |
getDefaultDataType(SQLDialect dialect,
java.lang.String typeName) |
static DataType<java.lang.Object> |
getDefaultDataType(java.lang.String typeName) |
SQLDialect |
getDialect()
Retrieve the underlying
SQLDialect . |
DataType<T> |
getSQLDataType()
Get the standard SQL data type of this (dialect-specific) data type if
available.
|
int |
getSQLType()
Get JDBC
Types value. |
int |
getSQLType(Configuration configuration)
Get the dialect-specific JDBC
Types value. |
java.lang.Class<T> |
getType()
Retrieve the Java type associated with this data type.
|
static java.lang.Class<?> |
getType(SQLDialect dialect,
java.lang.String t,
int p,
int s)
Convert a type name (using precision and scale) into a Java class
|
java.lang.String |
getTypeName()
Retrieve the dialect-specific type name associated with this data type.
|
java.lang.String |
getTypeName(Configuration configuration)
Retrieve the dialect-specific type name associated with this data type.
|
int |
hashCode() |
boolean |
hasLength()
Whether this data type has a length.
|
boolean |
hasPrecision()
Whether this data type has a precision.
|
boolean |
hasScale()
Whether this data type has a scale.
|
boolean |
identity()
Get the identity flag of this data type.
|
DataType<T> |
identity(boolean i)
Return a new data type like this, with a new identity flag.
|
boolean |
isArray()
Whether this data type is an array type.
|
boolean |
isBinary()
Whether this data type is any binary type.
|
boolean |
isDateTime()
Whether this data type is any date or time type.
|
boolean |
isInterval()
Whether this data type is any interval type.
|
boolean |
isLob()
Whether this data type is best deserialised as a
LOB . |
boolean |
isNumeric()
Whether this data type is any numeric data type.
|
boolean |
isString()
Whether this data type is any character data type.
|
boolean |
isTemporal()
Whether this data type is any date or time type.
|
boolean |
isUDT()
Whether this data type is a UDT type.
|
int |
length()
Get the length of this data type.
|
DataType<T> |
length(int l)
Return a new data type like this, with a new length value.
|
static java.lang.String |
normalise(java.lang.String typeName) |
Nullability |
nullability()
Get the nullability of this data type.
|
DataType<T> |
nullability(Nullability n)
Return a new data type like this, with a new nullability.
|
boolean |
nullable()
Get the nullability of this data type.
|
DataType<T> |
nullable(boolean n)
Return a new data type like this, with a new nullability.
|
int |
precision()
Get the precision of this data type.
|
DataType<T> |
precision(int p)
Return a new data type like this, with a new precision value.
|
DataType<T> |
precision(int p,
int s)
Return a new data type like this, with a new precision and scale value.
|
int |
scale()
Get the scale of this data type.
|
DataType<T> |
scale(int s)
Return a new data type like this, with a new scale value.
|
java.lang.String |
toString() |
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, java.lang.String typeName)
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, java.lang.String typeName, java.lang.String castTypeName)
public DefaultDataType(SQLDialect dialect, java.lang.Class<T> type, java.lang.String typeName)
public DefaultDataType(SQLDialect dialect, java.lang.Class<T> type, java.lang.String typeName, java.lang.String castTypeName)
public final DataType<T> nullability(Nullability n)
DataType
[#5709] A nullable
column cannot have an DataType.identity()
.
nullability
in interface DataType<T>
n
- The new nullabilitypublic final Nullability nullability()
DataType
nullability
in interface DataType<T>
public final DataType<T> nullable(boolean n)
DataType
This is the same as calling DataType.nullability(Nullability)
with any of
Nullability.NULL
or Nullability.NOT_NULL
as an argument.
[#5709] A nullable
column cannot have an
DataType.identity()
.
public final boolean nullable()
DataType
This returns true
by default, i.e. if DataType.nullability()
is Nullability.DEFAULT
.
public final DataType<T> identity(boolean i)
DataType
[#5709] The IDENTITY flag imposes a NOT NULL constraint, and removes all DEFAULT values.
public final boolean identity()
DataType
public final DataType<T> defaultValue(T d)
DataType
DEFAULT
value for
this data type.
[#5709] A defaulted
column cannot have an DataType.identity()
.
defaultValue
in interface DataType<T>
DataType.defaultValue(Field)
public final DataType<T> defaultValue(Field<T> d)
DataType
DEFAULT
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.
defaultValue
in interface DataType<T>
public final Field<T> defaultValue()
DataType
DEFAULT
value for this
data type.defaultValue
in interface DataType<T>
null
if no default
value is specified for this data type.DataType.defaultValue(Field)
@Deprecated public final DataType<T> defaulted(boolean d)
DataType
public final boolean defaulted()
DataType
public final DataType<T> precision(int p)
DataType
This will have no effect if DataType.hasPrecision()
is false
This is the same as calling DataType.precision(int, int)
with
scale == 0
public final DataType<T> precision(int p, int s)
DataType
This will have no effect if DataType.hasPrecision()
is false
, or if scale > 0
and DataType.hasScale()
is
false
public final int precision()
DataType
public final boolean hasPrecision()
DataType
hasPrecision
in interface DataType<T>
public final DataType<T> scale(int s)
DataType
This will have no effect if DataType.hasScale()
is false
public final int scale()
DataType
public final boolean hasScale()
DataType
public final DataType<T> length(int l)
DataType
This will have no effect if DataType.hasLength()
is false
public final int length()
DataType
public final boolean hasLength()
DataType
public final DataType<T> getSQLDataType()
DataType
getSQLDataType
in interface DataType<T>
public final DataType<T> getDataType(Configuration configuration)
DataType
getDataType
in interface DataType<T>
public int getSQLType()
DataType
Types
value.getSQLType
in interface DataType<T>
public final int getSQLType(Configuration configuration)
DataType
Types
value.getSQLType
in interface DataType<T>
public final java.lang.Class<T> getType()
DataType
public final Binding<?,T> getBinding()
DataType
getBinding
in interface DataType<T>
public final Converter<?,T> getConverter()
DataType
getConverter
in interface DataType<T>
public final java.lang.Class<T[]> getArrayType()
DataType
getArrayType
in interface DataType<T>
public final java.lang.String getTypeName()
DataType
getTypeName
in interface DataType<T>
public java.lang.String getTypeName(Configuration configuration)
DataType
getTypeName
in interface DataType<T>
public final java.lang.String getCastTypeName()
DataType
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))
getCastTypeName
in interface DataType<T>
public java.lang.String getCastTypeName(Configuration configuration)
DataType
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))
getCastTypeName
in interface DataType<T>
public final DataType<T[]> getArrayDataType()
DataType
getArrayDataType
in interface DataType<T>
public final <A extends ArrayRecord<?>> DataType<A> asArrayDataType(java.lang.Class<A> arrayDataType)
DataType
asArrayDataType
in interface DataType<T>
public final <E extends EnumType> DataType<E> asEnumDataType(java.lang.Class<E> enumDataType)
DataType
asEnumDataType
in interface DataType<T>
public final <U> DataType<U> asConvertedDataType(Converter<? super T,U> converter)
DataType
asConvertedDataType
in interface DataType<T>
public final <U> DataType<U> asConvertedDataType(Binding<? super T,U> newBinding)
DataType
asConvertedDataType
in interface DataType<T>
public final SQLDialect getDialect()
DataType
SQLDialect
.getDialect
in interface DataType<T>
public T convert(java.lang.Object object)
DataType
<T>
.
See Convert.convert(Object, Class)
for details about conversion rules.
public final T[] convert(java.lang.Object... objects)
DataType
<T>
.
See Convert.convert(Object, Class)
for details about conversion rules.
public final java.util.List<T> convert(java.util.Collection<?> objects)
DataType
<T>
.
See Convert.convert(Object, Class)
for details about conversion rules.
public static DataType<java.lang.Object> getDefaultDataType(java.lang.String typeName)
public static DataType<java.lang.Object> getDefaultDataType(SQLDialect dialect, java.lang.String typeName)
public static DataType<?> getDataType(SQLDialect dialect, java.lang.String typeName)
public static <T> DataType<T> getDataType(SQLDialect dialect, java.lang.Class<T> type)
public static <T> DataType<T> getDataType(SQLDialect dialect, java.lang.Class<T> type, DataType<T> fallbackDataType)
public final boolean isNumeric()
DataType
This applies to any of these types:
public final boolean isString()
DataType
This applies to any of these types:
public final boolean isDateTime()
DataType
This applies to any of these types.
isDateTime
in interface DataType<T>
public final boolean isTemporal()
DataType
This applies to any of these types.
SQLDataType.DATE
SQLDataType.TIME
SQLDataType.TIMESTAMP
SQLDataType.LOCALDATE
SQLDataType.LOCALTIME
SQLDataType.LOCALDATETIME
SQLDataType.OFFSETTIME
SQLDataType.OFFSETDATETIME
YearToMonth
DayToSecond
This is a combination of DataType.isDateTime()
or DataType.isInterval()
isTemporal
in interface DataType<T>
public final boolean isInterval()
DataType
This applies to any of these types.
isInterval
in interface DataType<T>
public final boolean isLob()
DataType
LOB
.
This applies to any of these types.
public final boolean isBinary()
DataType
This applies to any of these types.
public final boolean isArray()
DataType
public final boolean isUDT()
DataType
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static java.lang.String normalise(java.lang.String typeName)
public static DataType<?> getDataType(SQLDialect dialect, java.lang.String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedException
public static java.lang.Class<?> getType(SQLDialect dialect, java.lang.String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedException
Copyright © 2018. All Rights Reserved.