Module org.jooq
Package org.jooq.impl

Class UDTImpl<R extends UDTRecord<R>>

java.lang.Object
org.jooq.impl.UDTImpl<R>
All Implemented Interfaces:
Serializable, Fields, Named, Qualified, QueryPart, QueryPartInternal, RecordQualifier<R>, UDT<R>

@Internal public class UDTImpl<R extends UDTRecord<R>> extends Object implements UDT<R>
A common base type for UDT's

This type is for JOOQ INTERNAL USE only. Do not reference directly

Author:
Lukas Eder
See Also:
  • Constructor Details

  • Method Details

    • getCatalog

      public final Catalog getCatalog()
      Description copied from interface: Qualified
      Get the object's catalog.
      Specified by:
      getCatalog in interface Qualified
    • getSchema

      public Schema getSchema()
      Description copied from interface: Qualified
      Get the object's schema.
      Specified by:
      getSchema in interface Qualified
    • getQualifiedName

      public Name getQualifiedName()
      Description copied from interface: Named
      The qualified name of this object.
      Specified by:
      getQualifiedName in interface Named
    • getPackage

      public final Package getPackage()
      Description copied from interface: RecordQualifier
      Get the UDT package if this is a UDT, or null if it is not a UDT, or if it is a schema level UDT defined outside of a package.
      Specified by:
      getPackage in interface RecordQualifier<R extends UDTRecord<R>>
    • fieldsRow

      public final Row fieldsRow()
      Description copied from interface: Fields
      Get all fields known to this type as a Row.
      Specified by:
      fieldsRow in interface Fields
    • getRecordType

      public Class<R> getRecordType()
      Subclasses must override this method if they use the generic type parameter R for other types than Record
      Specified by:
      getRecordType in interface RecordQualifier<R extends UDTRecord<R>>
    • isSQLUsable

      public final boolean isSQLUsable()
      Description copied from interface: UDT
      Whether this data type can be used from SQL statements.
      Specified by:
      isSQLUsable in interface UDT<R extends UDTRecord<R>>
    • isSynthetic

      public final boolean isSynthetic()
      Description copied from interface: UDT
      Whether this data type is a synthetic, structural UDT type.

      This is true for example:

      • For Oracle TAB%ROWTYPE references, which are synthetic PL/SQL RECORD types in PL/SQL.
      Specified by:
      isSynthetic in interface UDT<R extends UDTRecord<R>>
    • newRecord

      public final R newRecord()
      Description copied from interface: RecordQualifier
      Create a new Record of this UDT's or Table's type.
      Specified by:
      newRecord in interface RecordQualifier<R extends UDTRecord<R>>
      See Also:
    • getDataType

      public final DataType<R> getDataType()
      Description copied from interface: RecordQualifier
      The UDT's or Table's data type as known to the database.
      Specified by:
      getDataType in interface RecordQualifier<R extends UDTRecord<R>>
    • accept

      public final void accept(Context<?> ctx)
      Description copied from interface: QueryPartInternal
      This QueryPart can accept a Context object in order to render a SQL string or to bind its variables.
      Specified by:
      accept in interface QueryPartInternal
    • createField

      @Deprecated protected static final <R extends UDTRecord<R>, T> UDTField<R,T> createField(String name, DataType<T> type, UDT<R> udt)
      Deprecated.
      - 3.12.0 - [#8000] - Use createField(Name, DataType, UDT) instead.
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      @Deprecated protected static final <R extends UDTRecord<R>, T> UDTField<R,T> createField(String name, DataType<T> type, UDT<R> udt, String comment)
      Deprecated.
      - 3.12.0 - [#8000] - Use createField(Name, DataType, UDT, String) instead.
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      @Deprecated protected static final <R extends UDTRecord<R>, T, U> UDTField<R,U> createField(String name, DataType<T> type, UDT<R> udt, String comment, Converter<T,U> converter)
      Deprecated.
      - 3.12.0 - [#8000] - Use createField(Name, DataType, UDT, String, Converter) instead.
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      @Deprecated protected static final <R extends UDTRecord<R>, T, U> UDTField<R,U> createField(String name, DataType<T> type, UDT<R> udt, String comment, Binding<T,U> binding)
      Deprecated.
      - 3.12.0 - [#8000] - Use createField(Name, DataType, UDT, String, Binding) instead.
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      @Deprecated protected static final <R extends UDTRecord<R>, T, X, U> UDTField<R,U> createField(String name, DataType<T> type, UDT<R> udt, String comment, Converter<X,U> converter, Binding<T,X> binding)
      Deprecated.
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      protected static final <R extends UDTRecord<R>, T> UDTField<R,T> createField(Name name, DataType<T> type, UDT<R> udt)
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      protected static final <R extends UDTRecord<R>, T> UDTField<R,T> createField(Name name, DataType<T> type, UDT<R> udt, String comment)
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      protected static final <R extends UDTRecord<R>, T, U> UDTField<R,U> createField(Name name, DataType<T> type, UDT<R> udt, String comment, Converter<T,U> converter)
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      protected static final <R extends UDTRecord<R>, T, U> UDTField<R,U> createField(Name name, DataType<T> type, UDT<R> udt, String comment, Binding<T,U> binding)
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • createField

      protected static final <R extends UDTRecord<R>, T, X, U> UDTField<R,U> createField(Name name, DataType<T> type, UDT<R> udt, String comment, Converter<X,U> converter, Binding<T,X> binding)
      Subclasses may call this method to create UDTField objects that are linked to this table.
      Parameters:
      name - The name of the field (case-sensitive!)
      type - The data type of the field
    • $schema

      public final Schema $schema()
      Description copied from interface: Qualified
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
      Specified by:
      $schema in interface Qualified
    • fields

      default Field<?>[] fields()
      Description copied from interface: Fields
      Get all fields known to this type.
      Specified by:
      fields in interface Fields
    • fieldStream

      default Stream<Field<?>> fieldStream()
      Description copied from interface: Fields
      Get all fields known to this type as a Stream.
      Specified by:
      fieldStream in interface Fields
    • field

      default <T> Field<T> field(Field<T> field)
      Description copied from interface: Fields
      Get a field known to this type by field reference.

      This will return:

      • A field that is the same as the argument field (by identity comparison).
      • A field that is equal to the argument field (exact matching fully qualified name).
      • A field that is equal to the argument field (partially matching qualified name).
      • A field whose name is equal to the unqualified name of the argument field.
      • null otherwise.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      Specified by:
      field in interface Fields
    • field

      @Deprecated default Field<?> field(String name)
      Deprecated.
      This method hides static import DSL.field(String).
      Description copied from interface: Fields
      Get a field known to this type by unqualified name, or null if no field is known to this type by this name.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      Specified by:
      field in interface Fields
      Parameters:
      name - The unqualified name of the field
    • field

      @Deprecated default <T> Field<T> field(String name, Class<T> type)
      Deprecated.
      This method hides static import DSL.field(String, Class).
      Description copied from interface: Fields
      Get a field known to this type by unqualified name coerced to type using Field.coerce(Class), or null if no field is known to this type by this name.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      NOTE [#15286]: It is strongly recommended to pass only Class references of types supported by jOOQ internally, i.e. types from SQLDataType. If you're using any custom data types by means of a Converter or Binding, it's better to pass that converted DataType reference explicitly to Fields.field(Name, DataType).

      Specified by:
      field in interface Fields
      Parameters:
      name - The unqualified name of the field
      type - The type to coerce the resulting field to
    • field

      @Deprecated default <T> Field<T> field(String name, DataType<T> dataType)
      Deprecated.
      This method hides static import DSL.field(String, DataType).
      Description copied from interface: Fields
      Get a field known to this type by unqualified name coerced to dataType using Field.coerce(DataType), or null if no field is known to this type by this name.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      Specified by:
      field in interface Fields
      Parameters:
      name - The unqualified name of the field
      dataType - The data type to coerce the resulting field to
    • field

      @Deprecated default Field<?> field(Name name)
      Deprecated.
      This method hides static import DSL.field(Name).
      Description copied from interface: Fields
      Get a field known to this type by qualified name, or null if no field is known to this type by this name.

      This will return:

      • A field whose name is equal to the argument field's name (exact matching fully qualified name).
      • A field whose name is equal to the argument field's name (partially matching qualified name).
      • A field whose name is equal to the unqualified name of the argument field.
      • null otherwise.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      Specified by:
      field in interface Fields
      Parameters:
      name - The qualified name of the field
    • field

      @Deprecated default <T> Field<T> field(Name name, Class<T> type)
      Deprecated.
      This method hides static import DSL.field(Name, Class).
      Description copied from interface: Fields
      Get a field known to this type by qualified name coerced to type using Field.coerce(Class), or null if no field is known to this type by this name.

      This will return:

      • A field whose name is equal to the argument field's name (exact matching fully qualified name).
      • A field whose name is equal to the argument field's name (partially matching qualified name).
      • A field whose name is equal to the unqualified name of the argument field.
      • null otherwise.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      NOTE [#15286]: It is strongly recommended to pass only Class references of types supported by jOOQ internally, i.e. types from SQLDataType. If you're using any custom data types by means of a Converter or Binding, it's better to pass that converted DataType reference explicitly to Fields.field(Name, DataType).

      Specified by:
      field in interface Fields
      Parameters:
      name - The qualified name of the field
      type - The type to coerce the resulting field to
    • field

      @Deprecated default <T> Field<T> field(Name name, DataType<T> dataType)
      Deprecated.
      This method hides static import DSL.field(String, DataType).
      Description copied from interface: Fields
      Get a field known to this type by qualified name coerced to dataType using Field.coerce(DataType), or null if no field is known to this type by this name.

      This will return:

      • A field whose name is equal to the argument field's name (exact matching fully qualified name).
      • A field whose name is equal to the argument field's name (partially matching qualified name).
      • A field whose name is equal to the unqualified name of the argument field.
      • null otherwise.

      If several fields have the same ambiguous name, the first one is returned and a warning is logged.

      Specified by:
      field in interface Fields
      Parameters:
      name - The qualified name of the field
      dataType - The data type to coerce the resulting field to
    • field

      default Field<?> field(int index)
      Description copied from interface: Fields
      Get a field known to this type by index, or null if no field is available at the index.
      Specified by:
      field in interface Fields
      Parameters:
      index - The 0-based index of the field
    • field

      default <T> Field<T> field(int index, Class<T> type)
      Description copied from interface: Fields
      Get a field known to this type by index coerced to type using Field.coerce(Class), or null if no field is available at the index.

      NOTE [#15286]: It is strongly recommended to pass only Class references of types supported by jOOQ internally, i.e. types from SQLDataType. If you're using any custom data types by means of a Converter or Binding, it's better to pass that converted DataType reference explicitly to Fields.field(Name, DataType).

      Specified by:
      field in interface Fields
      Parameters:
      index - The 0-based index of the field
      type - The type to coerce the resulting field to
    • field

      default <T> Field<T> field(int index, DataType<T> dataType)
      Description copied from interface: Fields
      Get a field known to this type by index coerced to dataType using Field.coerce(DataType), or null if no field is available at the index.
      Specified by:
      field in interface Fields
      Parameters:
      index - The 0-based index of the field
      dataType - The data type to coerce the resulting field to
    • fields

      default Field<?>[] fields(Field<?>... fields)
      Description copied from interface: Fields
      Get all fields, filtering by some fields.
      Specified by:
      fields in interface Fields
      Parameters:
      fields - The fields to include after looking them up via Fields.field(Field).
      See Also:
    • fields

      default Field<?>[] fields(String... names)
      Description copied from interface: Fields
      Get all fields known to this type, filtering by some unqualified field names.
      Specified by:
      fields in interface Fields
      Parameters:
      names - The unqualified field names to include after looking them up via Fields.field(String).
      See Also:
    • fields

      default Field<?>[] fields(Name... names)
      Description copied from interface: Fields
      Get all fields known to this type, filtering by some qualified field names.
      Specified by:
      fields in interface Fields
      Parameters:
      names - The qualified field names to include after looking them up via Fields.field(Name).
      See Also:
    • fields

      default Field<?>[] fields(int... indexes)
      Description copied from interface: Fields
      Get all fields known to this type, filtering by some field indexes.
      Specified by:
      fields in interface Fields
      See Also:
    • indexOf

      default int indexOf(Field<?> field)
      Description copied from interface: Fields
      Get a field's index from this type.

      The lookup algorithm is the same as that of Fields.field(Field).

      Specified by:
      indexOf in interface Fields
      Parameters:
      field - The field to look for
      Returns:
      The field's 0-based index or -1 if the field is not known to this type.
    • indexOf

      default int indexOf(String name)
      Description copied from interface: Fields
      Get a field's index from this type.

      The lookup algorithm is the same as that of Fields.field(String).

      Specified by:
      indexOf in interface Fields
      Parameters:
      name - The unqualified field name to look for
      Returns:
      The field's 0-based index or -1 if the field is not known to this type.
    • indexOf

      default int indexOf(Name name)
      Description copied from interface: Fields
      Get a field's index from this type.

      The lookup algorithm is the same as that of Fields.field(Name).

      Specified by:
      indexOf in interface Fields
      Parameters:
      name - The qualified field name to look for
      Returns:
      The field's 0-based index or -1 if the field is not known to this type.
    • types

      default Class<?>[] types()
      Description copied from interface: Fields
      Get an array of field types for fields known to this type.

      Entries in the resulting array correspond to Typed.getType() for the corresponding Field in Fields.fields()

      Specified by:
      types in interface Fields
    • type

      default Class<?> type(int index)
      Description copied from interface: Fields
      Get the field type for a given field index, or null if no field is available at the index.
      Specified by:
      type in interface Fields
      Parameters:
      index - The field's 0-based index
    • type

      default Class<?> type(String name)
      Description copied from interface: Fields
      Get the field type for a given unqualified field name, or null if no field is known to this type by this name.

      The lookup algorithm is the same as that of Fields.field(String).

      Specified by:
      type in interface Fields
      Parameters:
      name - The unqualified field name
    • type

      default Class<?> type(Name name)
      Description copied from interface: Fields
      Get the field type for a given qualified field name, or null if no field is known to this type by this name.

      The lookup algorithm is the same as that of Fields.field(Name).

      Specified by:
      type in interface Fields
      Parameters:
      name - The qualified field name
    • dataTypes

      default DataType<?>[] dataTypes()
      Description copied from interface: Fields
      Get an array of field data types for this type.

      Entries in the resulting array correspond to Typed.getDataType() for the corresponding Field in Fields.fields()

      Specified by:
      dataTypes in interface Fields
    • dataType

      default DataType<?> dataType(int index)
      Description copied from interface: Fields
      Get the field data type for a given field index, or null if no field is available at the index.
      Specified by:
      dataType in interface Fields
      Parameters:
      index - The field's 0-based index
    • dataType

      default DataType<?> dataType(String name)
      Description copied from interface: Fields
      Get the field data type for a given qualified field name, or null if no field is known to this type by this name.

      The lookup algorithm is the same as that of Fields.field(String).

      Specified by:
      dataType in interface Fields
      Parameters:
      name - The qualified field name
    • dataType

      default DataType<?> dataType(Name name)
      Description copied from interface: Fields
      Get the field data type for a given qualified field name, or null if no field is known to this type by this name.

      The lookup algorithm is the same as that of Fields.field(Name).

      Specified by:
      dataType in interface Fields
      Parameters:
      name - The qualified field name
    • $traverse

      default <R> R $traverse(Traverser<?,R> traverser)
      Description copied from interface: QueryPart
      Traverser this QueryPart expression tree using a composable Traverser, producing a result.

      This offers a generic way to traverse expression trees to translate the tree to arbitrary other data structures. The simplest traversal would just count all the tree elements:

      
       int count = CUSTOMER.NAME.eq(1).$traverse(0, (i, p) -> i + 1);
       

      The same can be achieved by translating the JDK Collector API to the Traverser API using Traversers.collecting(Collector).

      
       CUSTOMER.NAME.eq(1).$traverse(Traversers.collecting(Collectors.counting()));
       

      Unlike a Collector, a Traverser is optimised for tree traversal, not stream traversal:

      • Is not designed for parallelism
      • It can Traverser.abort() traversal early when the result can be produced early (e.g. when running Traversers.containing(QueryPart), and a result has been found).
      • It can decide whether to Traverser.recurse() into a QueryPart subtree, or whether that is not necessary or even undesirable, e.g. to prevent entering new subquery scopes.
      • Unlike a Collector, which can use its Collector.accumulator() to accumulate each element only once, in tree traversal, it's desirable to be able to distinguish between accumulating an item Traverser.before() or Traverser.after() recursing into it. This is useful e.g. to wrap each tree node in XML opening and closing tags.

      This is a commercial jOOQ edition only feature.

      Specified by:
      $traverse in interface QueryPart
    • $replace

      default QueryPart $replace(Replacer replacer)
      Description copied from interface: QueryPart
      Traverse a QueryPart hierarchy and recursively replace its elements by alternatives.

      This is a commercial jOOQ edition only feature.

      Specified by:
      $replace in interface QueryPart
    • getName

      public final String getName()
      Description copied from interface: Named
      The unqualified name of this object.
      Specified by:
      getName in interface Named
    • getUnqualifiedName

      public final Name getUnqualifiedName()
      Description copied from interface: Named
      The unqualified name of this object.
      Specified by:
      getUnqualifiedName in interface Named
    • getComment

      public final String getComment()
      Description copied from interface: Named
      The comment on this object.

      This is the same as calling Named.getCommentPart() and then Comment.getComment().

      Specified by:
      getComment in interface Named
    • getCommentPart

      public final Comment getCommentPart()
      Description copied from interface: Named
      The comment on this object as a QueryPart.
      Specified by:
      getCommentPart in interface Named
    • hashCode

      public int hashCode()
      Description copied from interface: QueryPart
      Generate a hash code from this QueryPart.

      In general, QueryPart hash codes are the same as the hash codes generated from QueryPart.toString(). This guarantees consistent behaviour with QueryPart.equals(Object)

      Some QueryPart implementations may choose to override this behaviour for improved performance, as QueryPart.toString() is an expensive operation, if called many times.

      Specified by:
      hashCode in interface QueryPart
      Returns:
      The QueryPart hash code
    • equals

      public boolean equals(Object that)
      Description copied from interface: QueryPart
      Check whether this QueryPart can be considered equal to another QueryPart.

      In general, QueryPart equality is defined in terms of QueryPart.toString() equality. In other words, two query parts are considered equal if their rendered SQL (with inlined bind variables) is equal. This means that the two query parts do not necessarily have to be of the same type.

      Some QueryPart implementations may choose to override this behaviour for improved performance, as QueryPart.toString() is an expensive operation, if called many times.

      Specified by:
      equals in interface QueryPart
      Parameters:
      that - The other QueryPart
      Returns:
      Whether the two query parts are equal
    • $name

      public final Name $name()
      Description copied from interface: Named
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
      Specified by:
      $name in interface Named
    • clauses

      @Deprecated public Clause[] clauses(Context<?> ctx)
      Deprecated.
      - 3.11.0 - [#8179] - This functionality will be removed in the future.
      Description copied from interface: QueryPartInternal
      The Clauses that are represented by this query part.

      QueryParts can specify several Clauses for which an event will be emitted before (in forward order) and after (in reverse order) visiting the the query part through Context.visit(QueryPart)

      This method is for JOOQ INTERNAL USE only. Do not reference directly

      Specified by:
      clauses in interface QueryPartInternal
      Returns:
      The Clauses represented by this query part or null or an empty array if this query part does not represent a clause.
    • rendersContent

      public boolean rendersContent(Context<?> ctx)
      Subclasses may override this
      Specified by:
      rendersContent in interface QueryPartInternal
    • declaresFields

      public boolean declaresFields()
      Subclasses may override this
      Specified by:
      declaresFields in interface QueryPartInternal
    • declaresTables

      public boolean declaresTables()
      Subclasses may override this
      Specified by:
      declaresTables in interface QueryPartInternal
    • declaresWindows

      public boolean declaresWindows()
      Subclasses may override this
      Specified by:
      declaresWindows in interface QueryPartInternal
    • declaresCTE

      public boolean declaresCTE()
      Subclasses may override this
      Specified by:
      declaresCTE in interface QueryPartInternal
    • declaresParameters

      @Pro public boolean declaresParameters()
      Subclasses may override this
      Specified by:
      declaresParameters in interface QueryPartInternal
    • generatesCast

      public boolean generatesCast()
      Subclasses may override this
      Specified by:
      generatesCast in interface QueryPartInternal
    • toString

      public String toString()
      Description copied from interface: QueryPart
      Render a SQL string representation of this QueryPart.

      For improved debugging, this renders a SQL string of this QueryPart with inlined bind variables. If this QueryPart is Attachable, then the attached Configuration may be used for rendering the SQL string, including SQLDialect and Settings. Do note that most QueryPart instances are not attached to a Configuration, and thus there is no guarantee that the SQL string will make sense in the context of a specific database.

      Specified by:
      toString in interface QueryPart
      Overrides:
      toString in class Object
      Returns:
      A SQL string representation of this QueryPart
    • create

      @Deprecated protected final DSLContext create()
      Deprecated.
      - 3.11.0 - [#6722] - Use Attachable.configuration() and Configuration.dsl() instead.
      Internal convenience method
    • create

      @Deprecated protected final DSLContext create(Configuration configuration)
      Deprecated.
      - 3.11.0 - [#6722] - Use Attachable.configuration() and Configuration.dsl() instead.
      Internal convenience method
    • create

      @Deprecated protected final DSLContext create(Context<?> ctx)
      Deprecated.
      - 3.11.0 - [#6722] - Use Attachable.configuration() and Configuration.dsl() instead.
      Internal convenience method
    • translate

      protected final DataAccessException translate(String sql, SQLException e)
      Internal convenience method