Module org.jooq
Package org.jooq

Interface DataType<T>

    • Method Detail

      • getSQLDataType

        @Nullable
        @Nullable DataType<T> getSQLDataType()
        Get the standard SQL data type of this (dialect-specific) data type if available.
      • getDataType

        @NotNull
        @NotNull DataType<T> getDataType​(Configuration configuration)
        The dialect-specific data type representing this data type.
      • getSQLType

        int getSQLType()
        Get JDBC Types value.
      • getSQLType

        int getSQLType​(Configuration configuration)
        Get the dialect-specific JDBC Types value.
      • getBinding

        @NotNull
        @NotNull Binding<?,​T> getBinding()
        Get the data type binding associated with this data type.
      • getConverter

        @NotNull
        @NotNull Converter<?,​T> getConverter()
        Get the converter associated with this data type.
      • getType

        @NotNull
        @NotNull Class<T> getType()
        Retrieve the Java type associated with this data type.
      • getDomain

        @Nullable
        @Nullable Domain<T> getDomain()
        Get the defining DOMAIN type or NULL if there is no such type.
      • getArrayType

        @NotNull
        @NotNull Class<T[]> getArrayType()
        Retrieve the Java type associated with ARRAYs of this data type.
      • getArrayDataType

        @NotNull
        @NotNull DataType<T[]> getArrayDataType()
        Retrieve the data type for an ARRAY of this data type.
      • getArrayComponentType

        @Nullable
        @Nullable Class<?> getArrayComponentType()
        Retrieve the Java component type if this is an ARRAY type, or null, otherwise.
      • getArrayComponentDataType

        @Nullable
        @Nullable DataType<?> getArrayComponentDataType()
        Retrieve the Java component data type if this is an ARRAY type, or null, otherwise.
      • asArrayDataType

        @NotNull
        @Pro
        <A extends ArrayRecord<?>> @NotNull DataType<A> asArrayDataType​(Class<A> arrayDataType)
        Retrieve the data type for an Oracle-style ARRAY of this data type.
      • asEnumDataType

        @NotNull
        <E extends EnumType> @NotNull DataType<E> asEnumDataType​(Class<E> enumDataType)
        Retrieve the data type for a given enum data type.
      • asConvertedDataType

        @NotNull
        <U> @NotNull DataType<U> asConvertedDataType​(Converter<? super T,​U> converter)
        Retrieve the data type for a given converter.
      • asConvertedDataType

        @NotNull
        <U> @NotNull DataType<U> asConvertedDataType​(Binding<? super T,​U> binding)
        Retrieve the data type for a given binding.
      • getTypeName

        @NotNull
        @NotNull String getTypeName()
        Retrieve the dialect-specific type name associated with this data type.
      • getTypeName

        @NotNull
        @NotNull String getTypeName​(Configuration configuration)
        Retrieve the dialect-specific type name associated with this data type.
      • getCastTypeName

        @NotNull
        @NotNull String getCastTypeName()
        Retrieve 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))

      • getCastTypeName

        @NotNull
        @NotNull String getCastTypeName​(Configuration configuration)
        Retrieve 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))

      • nullability

        @NotNull
        @Support
        @NotNull DataType<T> nullability​(Nullability nullability)
        Return a new data type like this, with a new nullability.

        [#5709] A nullable column cannot have an identity().

        Parameters:
        nullability - The new nullability
        Returns:
        The new data type
      • nullability

        @NotNull
        @NotNull Nullability nullability()
        Get the nullability of this data type.
        Returns:
        The nullability
      • nullable

        boolean nullable()
        Get the nullability of this data type.

        This returns true by default, i.e. if nullability() is Nullability.DEFAULT.

        Returns:
        The nullability
      • collation

        @Nullable
        @Nullable Collation collation()
        Get the collation of this data type, or null if there is no collation, or if the default collation applies.
      • characterSet

        @Nullable
        @Nullable CharacterSet characterSet()
        Get the character set of this data type, or null if there is no character set, or if the default character set applies.
      • identity

        @NotNull
        @Support
        @NotNull DataType<T> identity​(boolean identity)
        Return 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.

        Parameters:
        identity - The new identity flag
        Returns:
        The new data type
      • identity

        boolean identity()
        Get the identity flag of this data type.
        Returns:
        The identity flag.
      • defaultValue

        @NotNull
        @Support
        @NotNull DataType<T> defaultValue​(Field<T> defaultValue)
        Specify an expression to be applied as the 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.

        This is an alias for default_(Field).

      • defaultValue

        @Nullable
        @Nullable Field<T> defaultValue()
        The expression to be applied as the DEFAULT value for this data type.

        This is an alias for default_().

        Returns:
        The default value if present, or null if no default value is specified for this data type.
        See Also:
        defaultValue(Field)
      • default_

        @NotNull
        @Support
        @NotNull DataType<T> default_​(T defaultValue)
        Specify an expression to be applied as the DEFAULT value for this data type.

        [#5709] A defaulted column cannot have an identity().

        See Also:
        defaultValue(Field)
      • default_

        @NotNull
        @Support
        @NotNull DataType<T> default_​(Field<T> defaultValue)
        Specify an expression to be applied as the 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.

      • default_

        @Nullable
        @Nullable Field<T> default_()
        The expression to be applied as the DEFAULT value for this data type.
        Returns:
        The default value if present, or null if no default value is specified for this data type.
        See Also:
        defaultValue(Field)
      • defaulted

        @NotNull
        @Deprecated
        @NotNull DataType<T> defaulted​(boolean defaulted)
        Deprecated.
        - [#3852] - 3.8.0 - Use defaultValue(Field) instead.
        Return a new data type like this, with a new defaultability.
        Parameters:
        defaulted - The new defaultability
        Returns:
        The new data type
      • defaulted

        boolean defaulted()
        Get the defaultability of this data type.
        Returns:
        The defaultability
      • precision

        @NotNull
        @Support
        @NotNull DataType<T> precision​(int precision)
        Return a new data type like this, with a new precision value.

        This will have no effect if hasPrecision() is false

        This is the same as calling precision(int, int) with scale == 0

        Parameters:
        precision - The new precision value
        Returns:
        The new data type
      • precision

        @NotNull
        @Support
        @NotNull DataType<T> precision​(int precision,
                                       int scale)
        Return a new data type like this, with a new precision and scale value.

        This will have no effect if hasPrecision() is false , or if scale > 0 and hasScale() is false

        Parameters:
        precision - The new precision value
        scale - The new scale value
        Returns:
        The new data type
      • precision

        int precision()
        Get the precision of this data type.
        Returns:
        The precision of this data type
      • hasPrecision

        boolean hasPrecision()
        Whether this data type has a precision.
        Returns:
        Whether this data type has a precision
      • precisionDefined

        boolean precisionDefined()
        Whether the precision returned by precision() is defined.

        The default precision is 0 for all data types. If a data type does not have a precision (see hasPrecision()), or if it was initialised without precision (e.g. SQLDataType.TIMESTAMP), then the precision is not defined.

      • scale

        @NotNull
        @Support
        @NotNull DataType<T> scale​(int scale)
        Return a new data type like this, with a new scale value.

        This will have no effect if hasScale() is false

        Parameters:
        scale - The new scale value
        Returns:
        The new data type
      • scale

        int scale()
        Get the scale of this data type.
        Returns:
        The scale of this data type
      • hasScale

        boolean hasScale()
        Whether this data type has a scale.
        Returns:
        Whether this data type has a scale
      • scaleDefined

        boolean scaleDefined()
        Whether the precision returned by scale() is defined.

        The default scale is 0 for all data types. If a data type does not have a scale (see hasScale()), or if it was initialised without scale (e.g. SQLDataType.TIMESTAMP), then the scale is not defined.

      • length

        @NotNull
        @Support
        @NotNull DataType<T> length​(int length)
        Return a new data type like this, with a new length value.

        This will have no effect if hasLength() is false

        Parameters:
        length - The new length value
        Returns:
        The new data type
      • length

        int length()
        Get the length of this data type.
        Returns:
        The length of this data type
      • hasLength

        boolean hasLength()
        Whether this data type has a length.
        Returns:
        Whether this data type has a length
      • lengthDefined

        boolean lengthDefined()
        Whether the precision returned by length() is defined.

        The default length is 0 for all data types. If a data type does not have a length (see hasLength()), or if it was initialised without length (e.g. SQLDataType.TIMESTAMP), then the length is not defined.

      • isArray

        boolean isArray()
        Whether this data type is an array type.
      • isEmbeddable

        boolean isEmbeddable()
        Whether this data type is an embeddable type.
      • isUDT

        boolean isUDT()
        Whether this data type is a UDT type.
      • isEnum

        boolean isEnum()
        Whether this data type is an enum type.
      • isJSON

        boolean isJSON()
        Whether this data type is a JSON type.
      • isXML

        boolean isXML()
        Whether this data type is an XML type.