public class DefaultDataType<T> extends 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,
Class<T> type,
String typeName) |
DefaultDataType(SQLDialect dialect,
Class<T> type,
String typeName,
String castTypeName) |
DefaultDataType(SQLDialect dialect,
DataType<T> sqlDataType,
String typeName) |
DefaultDataType(SQLDialect dialect,
DataType<T> sqlDataType,
String typeName,
String castTypeName) |
| Modifier and Type | Method and Description |
|---|---|
<A extends ArrayRecord<?>> |
asArrayDataType(Class<A> arrayDataType)
Retrieve the data type for an Oracle-style ARRAY of this data type.
|
<U> DataType<U> |
asConvertedDataType(Binding<? super T,U> 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(Class<E> enumDataType)
Retrieve the data type for a given enum data type.
|
Collation |
collation()
Get the collation of this data type, or
null if there is no
collation, or if the default collation applies. |
DataType<T> |
collation(Collation c)
Return a new data type like this, with a new collation.
|
List<T> |
convert(Collection<?> objects)
Convert an arbitrary set of objects into
<T>. |
T[] |
convert(Object... objects)
Convert an arbitrary set of objects into
<T>. |
T |
convert(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(Object obj) |
DataType<T[]> |
getArrayDataType()
Retrieve the data type for an ARRAY of this data type.
|
Class<T[]> |
getArrayType()
Retrieve the Java type associated with ARRAYs of this data type.
|
Binding<?,T> |
getBinding()
Get the data type binding associated with this data type.
|
String |
getCastTypeName()
Retrieve the dialect-specific type name associated with this data type
used for casting.
|
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,
Class<T> type) |
static <T> DataType<T> |
getDataType(SQLDialect dialect,
Class<T> type,
DataType<T> fallbackDataType) |
static DataType<?> |
getDataType(SQLDialect dialect,
String typeName) |
static DataType<?> |
getDataType(SQLDialect dialect,
String t,
int p,
int s)
Convert a type name (using precision and scale) into a Java class
|
static DataType<Object> |
getDefaultDataType(SQLDialect dialect,
String typeName) |
static DataType<Object> |
getDefaultDataType(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. |
Class<T> |
getType()
Retrieve the Java type associated with this data type.
|
static Class<?> |
getType(SQLDialect dialect,
String t,
int p,
int s)
Convert a type name (using precision and scale) into a Java class
|
String |
getTypeName()
Retrieve the dialect-specific type name associated with this data type.
|
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 |
isEnum()
Whether this data type is an enum 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 String |
normalise(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.
|
String |
toString() |
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, String typeName)
public DefaultDataType(SQLDialect dialect, DataType<T> sqlDataType, String typeName, String castTypeName)
public DefaultDataType(SQLDialect dialect, Class<T> type, String typeName)
public DefaultDataType(SQLDialect dialect, Class<T> type, String typeName, 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()
DataTypenullability 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> collation(Collation c)
DataTypepublic final Collation collation()
DataTypenull if there is no
collation, or if the default collation applies.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()
DataTypepublic final DataType<T> defaultValue(T d)
DataTypeDEFAULT 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)
DataTypeDEFAULT value 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 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()
DataTypeDEFAULT 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)
DataTypepublic final boolean defaulted()
DataTypepublic 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()
DataTypepublic final boolean hasPrecision()
DataTypehasPrecision 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()
DataTypepublic final boolean hasScale()
DataTypepublic final DataType<T> length(int l)
DataType
This will have no effect if DataType.hasLength() is false
public final int length()
DataTypepublic final boolean hasLength()
DataTypepublic final DataType<T> getSQLDataType()
DataTypegetSQLDataType in interface DataType<T>public final DataType<T> getDataType(Configuration configuration)
DataTypegetDataType in interface DataType<T>public int getSQLType()
DataTypeTypes value.getSQLType in interface DataType<T>public final int getSQLType(Configuration configuration)
DataTypeTypes value.getSQLType in interface DataType<T>public final Class<T> getType()
DataTypepublic final Binding<?,T> getBinding()
DataTypegetBinding in interface DataType<T>public final Converter<?,T> getConverter()
DataTypegetConverter in interface DataType<T>public final Class<T[]> getArrayType()
DataTypegetArrayType in interface DataType<T>public final String getTypeName()
DataTypegetTypeName in interface DataType<T>public String getTypeName(Configuration configuration)
DataTypegetTypeName in interface DataType<T>public final String getCastTypeName()
DataTypeThis 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 String getCastTypeName(Configuration configuration)
DataTypeThis 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()
DataTypegetArrayDataType in interface DataType<T>public final <A extends ArrayRecord<?>> DataType<A> asArrayDataType(Class<A> arrayDataType)
DataTypeasArrayDataType in interface DataType<T>public final <E extends EnumType> DataType<E> asEnumDataType(Class<E> enumDataType)
DataTypeasEnumDataType in interface DataType<T>public final <U> DataType<U> asConvertedDataType(Converter<? super T,U> converter)
DataTypeasConvertedDataType in interface DataType<T>public final <U> DataType<U> asConvertedDataType(Binding<? super T,U> newBinding)
DataTypeasConvertedDataType in interface DataType<T>public final SQLDialect getDialect()
DataTypeSQLDialect.getDialect in interface DataType<T>public T convert(Object object)
DataType<T>.
See Convert.convert(Object, Class) for details about conversion rules.
public final T[] convert(Object... objects)
DataType<T>.
See Convert.convert(Object, Class) for details about conversion rules.
public final List<T> convert(Collection<?> objects)
DataType<T>.
See Convert.convert(Object, Class) for details about conversion rules.
public static final DataType<Object> getDefaultDataType(SQLDialect dialect, String typeName)
public static final DataType<?> getDataType(SQLDialect dialect, String typeName)
public static final <T> DataType<T> getDataType(SQLDialect dialect, Class<T> type)
public static final <T> DataType<T> getDataType(SQLDialect dialect, Class<T> type, DataType<T> fallbackDataType)
public final boolean isNumeric()
DataTypeThis applies to any of these types:
public final boolean isString()
DataTypeThis applies to any of these types:
public final boolean isDateTime()
DataTypeThis applies to any of these types.
isDateTime in interface DataType<T>public final boolean isTemporal()
DataTypeThis applies to any of these types.
SQLDataType.DATESQLDataType.TIMESQLDataType.TIMESTAMPSQLDataType.LOCALDATESQLDataType.LOCALTIMESQLDataType.LOCALDATETIMESQLDataType.OFFSETTIMESQLDataType.OFFSETDATETIMEYearToMonthDayToSecond
This is a combination of DataType.isDateTime() or DataType.isInterval()
isTemporal in interface DataType<T>public final boolean isInterval()
DataTypeThis applies to any of these types.
isInterval in interface DataType<T>public final boolean isLob()
DataTypeLOB.
This applies to any of these types.
public final boolean isBinary()
DataTypeThis applies to any of these types.
public final boolean isArray()
DataTypepublic final boolean isUDT()
DataTypepublic final boolean isEnum()
DataTypepublic static final String normalise(String typeName)
public static final DataType<?> getDataType(SQLDialect dialect, String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedExceptionpublic static final Class<?> getType(SQLDialect dialect, String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedExceptionCopyright © 2019. All rights reserved.