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> binding)
Retrieve the data type for a given converter.
|
<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)
Return a new data type like this, with a new defaultability.
|
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.
|
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.
|
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. |
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 |
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 java.lang.String |
normalise(java.lang.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.
|
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> nullable(boolean n)
DataType
public final boolean nullable()
DataType
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 java.lang.Class<T> getType()
DataType
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> binding)
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>
.public final T[] convert(java.lang.Object... objects)
DataType
<T>
.public final java.util.List<T> convert(java.util.Collection<?> objects)
DataType
<T>
.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.
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 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 © 2014. All Rights Reserved.