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.
|
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. |
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 |
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.
|
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) |
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> nullable(boolean n)
DataType
public final boolean nullable()
DataType
public final DataType<T> defaultValue(T d)
DataType
DEFAULT
value for
this data type.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 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 Class<T[]> getArrayType()
DataType
getArrayType
in interface DataType<T>
public final String getTypeName()
DataType
getTypeName
in interface DataType<T>
public String getTypeName(Configuration configuration)
DataType
getTypeName
in interface DataType<T>
public final 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 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(Class<A> arrayDataType)
DataType
asArrayDataType
in interface DataType<T>
public final <E extends EnumType> DataType<E> asEnumDataType(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(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 DataType<Object> getDefaultDataType(SQLDialect dialect, String typeName)
public static DataType<?> getDataType(SQLDialect dialect, String typeName)
public static <T> DataType<T> getDataType(SQLDialect dialect, Class<T> type)
public static <T> DataType<T> getDataType(SQLDialect dialect, 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 static String normalise(String typeName)
public static DataType<?> getDataType(SQLDialect dialect, String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedException
public static Class<?> getType(SQLDialect dialect, String t, int p, int s) throws SQLDialectNotSupportedException
SQLDialectNotSupportedException
Copyright © 2016. All Rights Reserved.