Top Description Methods
org.jooq

public Interface Fields

Known Direct Subinterfaces
org.jooq.Record, org.jooq.Cursor, org.jooq.RecordQualifier, org.jooq.RecordType, org.jooq.Result, org.jooq.ResultQuery, org.jooq.TableLike, org.jooq.Row, org.jooq.impl.FieldsTrait
Imports
java.util.stream.Stream, org.jooq.impl.DSL, org.jetbrains.annotations.NotNull, .Nullable

A common super type for various types that can provide a set of fields, similar to a Table or a Record.

Ambiguities

Fields may or may not be qualified. Independently of qualification, dialects may produce duplicate fields by name in top level queries, e.g.:


SELECT 1 AS id, 2 AS id, public.a.id
FROM public.a

In the above unfortunate example, there are 3 ambiguous ID columns. Only one of them is qualified as A.ID, whereas the other two are unqualified aliases that cannot be distinguished by name, only by index. The behaviour of the various field access methods can be summarised as follows:

Whenever an ambiguity is encountered, a warning is logged to help debug the case. Future jOOQ versions might throw an exception upon ambiguity.

Unknown fields

Not all implementations actually know their fields. For example, when using plain SQL templates (DSL#field(String)) or tables constructed from identifiers (DSL#field(Name)), then the fields are unknown to jOOQ and empty lists or arrays are returned, or null is returned on single field returning methods.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public @Nullable DataType<?>
dataType(int
The field's 0-based index
index
)

Get the field data type for a given field index, or null if no field is available at the index.

public @Nullable DataType<?>
dataType(String
The qualified field name
name
)

Get the field data type for a given qualified field name, or null if no field is known to this type by this name.

public @Nullable DataType<?>
dataType(Name
The qualified field name
name
)

Get the field data type for a given qualified field name, or null if no field is known to this type by this name.

public @NotNull @NotNull DataType<?>[]
dataTypes()

Get an array of field data types for this type.

public <T> @Nullable Field<T>
field(Field<T> field)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by field reference.
public @Nullable Field<?>
field(String
The unqualified name of the field
name
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by unqualified name, or null if no field is known to this type by this name.
public <T> @Nullable Field<T>
field(String
The unqualified name of the field
name
,
Class<T>
The type to coerce the resulting field to
type
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by unqualified name coerced to type, or null if no field is known to this type by this name.
public <T> @Nullable Field<T>
field(String
The unqualified name of the field
name
,
DataType<T>
The data type to coerce the resulting field to
dataType
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by unqualified name coerced to dataType, or null if no field is known to this type by this name.
public @Nullable Field<?>
field(Name
The qualified name of the field
name
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by qualified name, or null if no field is known to this type by this name.
public <T> @Nullable Field<T>
field(Name
The qualified name of the field
name
,
Class<T>
The type to coerce the resulting field to
type
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by qualified name coerced to type, or null if no field is known to this type by this name.
public <T> @Nullable Field<T>
field(Name
The qualified name of the field
name
,
DataType<T>
The data type to coerce the resulting field to
dataType
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by qualified name coerced to dataType, or null if no field is known to this type by this name.
public @Nullable Field<?>
field(int
The 0-based index of the field
index
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by index, or null if no field is available at the index.
public <T> @Nullable Field<T>
field(int
The 0-based index of the field
index
,
Class<T>
The type to coerce the resulting field to
type
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by index coerced to type, or null if no field is available at the index.
public <T> @Nullable Field<T>
field(int
The 0-based index of the field
index
,
DataType<T>
The data type to coerce the resulting field to
dataType
)

Deprecated as a consequence of Field being deprecated.
Get a field known to this type by index coerced to dataType, or null if no field is available at the index.
public @NotNull @NotNull Field<?>[]
fields()

Deprecated as a consequence of Field being deprecated.
Get all fields known to this type.
public @NotNull @Nullable Field<?>[]
fields(Field<?>...
The fields to include after looking them up via field(Field).
fields
)

Deprecated as a consequence of Field being deprecated.
Get all fields, filtering by some fields.
public @NotNull @Nullable Field<?>[]
fields(String...
The unqualified field names to include after looking them up via field(String).
names
)

Deprecated as a consequence of Field being deprecated.
Get all fields known to this type, filtering by some unqualified field names.
public @NotNull @Nullable Field<?>[]
fields(Name...
The qualified field names to include after looking them up via field(Name).
names
)

Deprecated as a consequence of Field being deprecated.
Get all fields known to this type, filtering by some qualified field names.
public @NotNull @Nullable Field<?>[]
fields(int...
The 0-based field indexes to include after looking them up via field(int).
indexes
)

Deprecated as a consequence of Field being deprecated.
Get all fields known to this type, filtering by some field indexes.
public @NotNull Row
fieldsRow()

Get all fields known to this type as a Row.

public @NotNull Stream<Field<?>>
fieldStream()

Get all fields known to this type as a Stream.

public int

Returns:

The field's 0-based index or -1 if the field is not known to this type.
indexOf
(Field<?>
The field to look for
field
)

Deprecated as a consequence of Field being deprecated.
Get a field's index from this type.
public int

Returns:

The field's 0-based index or -1 if the field is not known to this type.
indexOf
(String
The unqualified field name to look for
name
)

Get a field's index from this type.

public int

Returns:

The field's 0-based index or -1 if the field is not known to this type.
indexOf
(Name
The qualified field name to look for
name
)

Get a field's index from this type.

public @Nullable Class<?>
type(int
The field's 0-based index
index
)

Get the field type for a given field index, or null if no field is available at the index.

public @Nullable Class<?>
type(String
The unqualified field name
name
)

Get the field type for a given unqualified field name, or null if no field is known to this type by this name.

public @Nullable Class<?>
type(Name
The qualified field name
name
)

Get the field type for a given qualified field name, or null if no field is known to this type by this name.

public @NotNull @NotNull Class<?>[]
types()

Get an array of field types for fields known to this type.

Method Detail

dataTypeback to summary
public @Nullable DataType<?> dataType(int index)

Get the field data type for a given field index, or null if no field is available at the index.

Parameters
index:int

The field's 0-based index

Annotations
@Nullable
dataTypeback to summary
public @Nullable DataType<?> dataType(String name)

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 field(String).

Parameters
name:String

The qualified field name

Annotations
@Nullable
dataTypeback to summary
public @Nullable DataType<?> dataType(Name name)

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 field(Name).

Parameters
name:Name

The qualified field name

Annotations
@Nullable
dataTypesback to summary
public @NotNull @NotNull DataType<?>[] dataTypes()

Get an array of field data types for this type.

Entries in the resulting array correspond to Field#getDataType() for the corresponding Field in fields()

Annotations
@NotNull
fieldback to summary
public <T> @Nullable Field<T> field(Field<T> field)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

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.

Annotations
@Nullable
fieldback to summary
public @Nullable Field<?> field(String name)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

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.

Parameters
name:String

The unqualified name of the field

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(String name, Class<T> type)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by unqualified name coerced to type, 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.

Parameters
name:String

The unqualified name of the field

type:Class<T>

The type to coerce the resulting field to

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(String name, DataType<T> dataType)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by unqualified name coerced to 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.

Parameters
name:String

The unqualified name of the field

dataType:DataType<T>

The data type to coerce the resulting field to

Annotations
@Nullable
fieldback to summary
public @Nullable Field<?> field(Name name)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

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.

Parameters
name:Name

The qualified name of the field

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(Name name, Class<T> type)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by qualified name coerced to type, 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.

Parameters
name:Name

The qualified name of the field

type:Class<T>

The type to coerce the resulting field to

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(Name name, DataType<T> dataType)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by qualified name coerced to 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.

Parameters
name:Name

The qualified name of the field

dataType:DataType<T>

The data type to coerce the resulting field to

Annotations
@Nullable
fieldback to summary
public @Nullable Field<?> field(int index)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by index, or null if no field is available at the index.

Parameters
index:int

The 0-based index of the field

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(int index, Class<T> type)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by index coerced to type, or null if no field is available at the index.

Parameters
index:int

The 0-based index of the field

type:Class<T>

The type to coerce the resulting field to

Annotations
@Nullable
fieldback to summary
public <T> @Nullable Field<T> field(int index, DataType<T> dataType)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field known to this type by index coerced to dataType, or null if no field is available at the index.

Parameters
index:int

The 0-based index of the field

dataType:DataType<T>

The data type to coerce the resulting field to

Annotations
@Nullable
fieldsback to summary
public @NotNull @NotNull Field<?>[] fields()

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get all fields known to this type.

Annotations
@NotNull
fieldsback to summary
public @NotNull @Nullable Field<?>[] fields(Field<?>... fields)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get all fields, filtering by some fields.

Parameters
fields:Field<?>[]

The fields to include after looking them up via field(Field).

Annotations
@Nullable
See Also
field(Field)
fieldsback to summary
public @NotNull @Nullable Field<?>[] fields(String... names)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get all fields known to this type, filtering by some unqualified field names.

Parameters
names:String[]

The unqualified field names to include after looking them up via field(String).

Annotations
@Nullable
See Also
field(String)
fieldsback to summary
public @NotNull @Nullable Field<?>[] fields(Name... names)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get all fields known to this type, filtering by some qualified field names.

Parameters
names:Name[]

The qualified field names to include after looking them up via field(Name).

Annotations
@Nullable
See Also
field(Name)
fieldsback to summary
public @NotNull @Nullable Field<?>[] fields(int... indexes)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get all fields known to this type, filtering by some field indexes.

Parameters
indexes:int[]

The 0-based field indexes to include after looking them up via field(int).

Annotations
@Nullable
See Also
field(int)
fieldsRowback to summary
public @NotNull Row fieldsRow()

Get all fields known to this type as a Row.

Annotations
@NotNull
fieldStreamback to summary
public @NotNull Stream<Field<?>> fieldStream()

Get all fields known to this type as a Stream.

Annotations
@NotNull
indexOfback to summary
public int indexOf(Field<?> field)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Get a field's index from this type.

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

Parameters
field:Field<?>

The field to look for

Returns:int

The field's 0-based index or -1 if the field is not known to this type.

indexOfback to summary
public int indexOf(String name)

Get a field's index from this type.

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

Parameters
name:String

The unqualified field name to look for

Returns:int

The field's 0-based index or -1 if the field is not known to this type.

indexOfback to summary
public int indexOf(Name name)

Get a field's index from this type.

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

Parameters
name:Name

The qualified field name to look for

Returns:int

The field's 0-based index or -1 if the field is not known to this type.

typeback to summary
public @Nullable Class<?> type(int index)

Get the field type for a given field index, or null if no field is available at the index.

Parameters
index:int

The field's 0-based index

Annotations
@Nullable
typeback to summary
public @Nullable Class<?> type(String name)

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 field(String).

Parameters
name:String

The unqualified field name

Annotations
@Nullable
typeback to summary
public @Nullable Class<?> type(Name name)

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 field(Name).

Parameters
name:Name

The qualified field name

Annotations
@Nullable
typesback to summary
public @NotNull @NotNull Class<?>[] types()

Get an array of field types for fields known to this type.

Entries in the resulting array correspond to Field#getType() for the corresponding Field in fields()

Annotations
@NotNull