Module org.jooq
Package org.jooq

Interface Row

  • All Superinterfaces:
    FieldOrRow, QueryPart, Serializable
    All Known Subinterfaces:
    Row1<T1>, Row10<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10>, Row11<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11>, Row12<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12>, Row13<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13>, Row14<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14>, Row15<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15>, Row16<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16>, Row17<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17>, Row18<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18>, Row19<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19>, Row2<T1,​T2>, Row20<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20>, Row21<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21>, Row22<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21,​T22>, Row3<T1,​T2,​T3>, Row4<T1,​T2,​T3,​T4>, Row5<T1,​T2,​T3,​T4,​T5>, Row6<T1,​T2,​T3,​T4,​T5,​T6>, Row7<T1,​T2,​T3,​T4,​T5,​T6,​T7>, Row8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>, Row9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>, RowN

    public interface Row
    extends FieldOrRow
    A row value expression.

    Row value expressions are mainly useful for use in predicates, when comparing several values in one go, which can be more elegant than expanding the row value expression predicate in other equivalent syntaxes. This is especially true for non-equality predicates. For instance, the following two predicates are equivalent in SQL:

     (A, B) > (X, Y)
     (A > X) OR (A = X AND B > Y)
     

    Example:

     // Assuming import static org.jooq.impl.DSL.*;
    
     using(configuration)
        .select()
        .from(CUSTOMER)
        .where(row(CUSTOMER.FIRST_NAME, CUSTOMER.LAST_NAME).in(
            select(ACTOR.FIRST_NAME, ACTOR.LAST_NAME).from(ACTOR)
        ))
        .fetch();
     

    Note: Not all databases support row value expressions, but many row value expression operations can be emulated on all databases. See relevant row value expression method Javadocs for details.

    Instances can be created using DSL.row(Object...) and overloads.

    Author:
    Lukas Eder
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @Nullable DataType<?> dataType​(int fieldIndex)
      Get the data type for a given field index.
      @Nullable DataType<?> dataType​(String fieldName)
      Get the data type for a given field name.
      @Nullable DataType<?> dataType​(Name fieldName)
      Get the data type for a given field name.
      @NotNull DataType<?>[] dataTypes()
      Get an array of data types for this row.
      @Nullable Field<?> field​(int fieldIndex)
      Get a specific field from this row.
      <T> @Nullable Field<T> field​(int fieldIndex, Class<T> type)
      Get a specific field from this row and coerce it to type.
      <T> @Nullable Field<T> field​(int fieldIndex, DataType<T> dataType)
      Get a specific field from this row and coerce it to dataType.
      @Nullable Field<?> field​(String fieldName)
      Get a specific field from this row.
      <T> @Nullable Field<T> field​(String fieldName, Class<T> type)
      Get a specific field from this row and coerce it to type.
      <T> @Nullable Field<T> field​(String fieldName, DataType<T> dataType)
      Get a specific field from this row and coerce it to dataType.
      <T> @Nullable Field<T> field​(Field<T> field)
      Get a specific field from this row.
      @Nullable Field<?> field​(Name fieldName)
      Get a specific field from this row.
      <T> @Nullable Field<T> field​(Name fieldName, Class<T> type)
      Get a specific field from this row and coerce it to type.
      <T> @Nullable Field<T> field​(Name fieldName, DataType<T> dataType)
      Get a specific field from this row and coerce it to dataType.
      @NotNull Field<?>[] fields()
      Get all fields from this row.
      @NotNull Field<?>[] fields​(int... fieldIndexes)
      Get all fields from this row, providing some field indexes.
      @NotNull Field<?>[] fields​(String... fieldNames)
      Get all fields from this row, providing some field names.
      @NotNull Field<?>[] fields​(Field<?>... fields)
      Get all fields from this row, providing some fields.
      @NotNull Field<?>[] fields​(Name... fieldNames)
      Get all fields from this row, providing some field names.
      @NotNull Stream<Field<?>> fieldStream()
      Get the fields from this row as a Stream.
      int indexOf​(String fieldName)
      Get a field's index from this row.
      int indexOf​(Field<?> field)
      Get a field's index from this row.
      int indexOf​(Name fieldName)
      Get a field's index from this row.
      @NotNull Condition isNotNull()
      Check if this row value expression contains no NULL values.
      @NotNull Condition isNull()
      Check if this row value expression contains only NULL values.
      int size()
      Get the degree of this row value expression.
      @Nullable Class<?> type​(int fieldIndex)
      Get the type for a given field index.
      @Nullable Class<?> type​(String fieldName)
      Get the type for a given field name.
      @Nullable Class<?> type​(Name fieldName)
      Get the type for a given field name.
      @NotNull Class<?>[] types()
      Get an array of types for this row.
    • Method Detail

      • size

        int size()
        Get the degree of this row value expression.
      • fieldStream

        @NotNull
        @NotNull Stream<Field<?>> fieldStream()
        Get the fields from this row as a Stream.
      • field

        @Nullable
        <T> @Nullable Field<T> field​(Field<T> field)
        Get a specific field from this row.

        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 name of the argument field.
        • null otherwise.
        If several fields have the same name, the first one is returned and a warning is logged.
        Type Parameters:
        T - The generic field type
        Parameters:
        field - The field to fetch
        Returns:
        The field itself or an aliased field
      • field

        @Nullable
        @Nullable Field<?> field​(String fieldName)
        Get a specific field from this row.
        Parameters:
        fieldName - The field to fetch
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(String fieldName,
                                     Class<T> type)
        Get a specific field from this row and coerce it to type.
        Parameters:
        fieldName - The field to fetch
        type - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(String fieldName,
                                     DataType<T> dataType)
        Get a specific field from this row and coerce it to dataType.
        Parameters:
        fieldName - The field to fetch
        dataType - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • field

        @Nullable
        @Nullable Field<?> field​(Name fieldName)
        Get a specific field from this row.
        Parameters:
        fieldName - The field to fetch
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(Name fieldName,
                                     Class<T> type)
        Get a specific field from this row and coerce it to type.
        Parameters:
        fieldName - The field to fetch
        type - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(Name fieldName,
                                     DataType<T> dataType)
        Get a specific field from this row and coerce it to dataType.
        Parameters:
        fieldName - The field to fetch
        dataType - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • field

        @Nullable
        @Nullable Field<?> field​(int fieldIndex)
        Get a specific field from this row.
        Parameters:
        fieldIndex - The field's index of the field to fetch
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(int fieldIndex,
                                     Class<T> type)
        Get a specific field from this row and coerce it to type.
        Parameters:
        fieldIndex - The field's index of the field to fetch
        type - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • field

        @Nullable
        <T> @Nullable Field<T> field​(int fieldIndex,
                                     DataType<T> dataType)
        Get a specific field from this row and coerce it to dataType.
        Parameters:
        fieldIndex - The field's index of the field to fetch
        dataType - The type to coerce the resulting field to
        Returns:
        The field with the given name
      • fields

        @NotNull
        @NotNull Field<?>[] fields()
        Get all fields from this row.
        Returns:
        All available fields
      • fields

        @NotNull
        @NotNull Field<?>[] fields​(Field<?>... fields)
        Get all fields from this row, providing some fields.
        Returns:
        All available fields
        See Also:
        field(Field)
      • fields

        @NotNull
        @NotNull Field<?>[] fields​(String... fieldNames)
        Get all fields from this row, providing some field names.
        Returns:
        All available fields
        See Also:
        field(String)
      • fields

        @NotNull
        @NotNull Field<?>[] fields​(Name... fieldNames)
        Get all fields from this row, providing some field names.
        Returns:
        All available fields
        See Also:
        field(Name)
      • fields

        @NotNull
        @NotNull Field<?>[] fields​(int... fieldIndexes)
        Get all fields from this row, providing some field indexes.
        Returns:
        All available fields
        See Also:
        field(int)
      • indexOf

        int indexOf​(Field<?> field)
        Get a field's index from this row.
        Parameters:
        field - The field to look for
        Returns:
        The field's index or -1 if the field is not contained in this Row
      • indexOf

        int indexOf​(String fieldName)
        Get a field's index from this row.
        Parameters:
        fieldName - The field name to look for
        Returns:
        The field's index or -1 if the field is not contained in this Row
      • indexOf

        int indexOf​(Name fieldName)
        Get a field's index from this row.
        Parameters:
        fieldName - The field name to look for
        Returns:
        The field's index or -1 if the field is not contained in this Row
      • types

        @NotNull
        @NotNull Class<?>[] types()
        Get an array of types for this row.

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

      • type

        @Nullable
        @Nullable Class<?> type​(int fieldIndex)
        Get the type for a given field index.
        Parameters:
        fieldIndex - The field's index of the field's type to fetch
        Returns:
        The field's type
      • type

        @Nullable
        @Nullable Class<?> type​(String fieldName)
        Get the type for a given field name.
        Parameters:
        fieldName - The field's name of the field's type to fetch
        Returns:
        The field's type
      • type

        @Nullable
        @Nullable Class<?> type​(Name fieldName)
        Get the type for a given field name.
        Parameters:
        fieldName - The field's name of the field's type to fetch
        Returns:
        The field's type
      • dataTypes

        @NotNull
        @NotNull DataType<?>[] dataTypes()
        Get an array of data types for this row.

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

      • dataType

        @Nullable
        @Nullable DataType<?> dataType​(int fieldIndex)
        Get the data type for a given field index.
        Parameters:
        fieldIndex - The field's index of the field's data type to fetch
        Returns:
        The field's data type
      • dataType

        @Nullable
        @Nullable DataType<?> dataType​(String fieldName)
        Get the data type for a given field name.
        Parameters:
        fieldName - The field's name of the field's data type to fetch
        Returns:
        The field's data type
      • dataType

        @Nullable
        @Nullable DataType<?> dataType​(Name fieldName)
        Get the data type for a given field name.
        Parameters:
        fieldName - The field's name of the field's data type to fetch
        Returns:
        The field's data type
      • isNull

        @NotNull
        @Support
        @NotNull Condition isNull()
        Check if this row value expression contains only NULL values.

        Row NULL predicates can be emulated in those databases that do not support such predicates natively: (A, B) IS NULL is equivalent to A IS NULL AND B IS NULL

      • isNotNull

        @NotNull
        @Support
        @NotNull Condition isNotNull()
        Check if this row value expression contains no NULL values.

        Row NOT NULL predicates can be emulated in those databases that do not support such predicates natively: (A, B) IS NOT NULL is equivalent to A IS NOT NULL AND B IS NOT NULL

        Note that the two following predicates are NOT equivalent:

        • (A, B) IS NOT NULL, which is the same as (A IS NOT NULL) AND (B IS NOT NULL)
        • NOT((A, B) IS NULL), which is the same as (A IS NOT NULL) OR (B IS NOT NULL)