org.firebirdsql.gds.ng.fields

## Class RowValueBuilder

- java.lang.Object
- - org.firebirdsql.gds.ng.fields.RowValueBuilder

-     public class RowValueBuilder
      extends java.lang.Object

  Builder for `RowValue` instances.

  This class allows for sparse population of column values (ie: `null` values can be skipped). It is intended for use in tests and classes like `FBDatabaseMetaData`.

  Its main advantage over `RowValue.of(RowDescriptor, byte[][])` is that it is clearer to which field the value is assigned, and it sparse population (ie: skipping `null` values).

  Author:
    Mark Rotteveel
  See Also:
    `RowValue.of(RowDescriptor, byte[][])`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RowValueBuilder(RowDescriptor rowDescriptor)` Creates instance of RowValueBuilder.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RowValueBuilder` | `at(int index)` Convenience shortcut for `setFieldIndex(int)`.
    `byte[]` | `get(int index)` Retrieves the field data set at the specified index.
    `int` | `getSize()`
    `RowValueBuilder` | `reset()` Resets this builder to a new RowValue.
    `RowValueBuilder` | `resetField()` Resets to current field to its default uninitialized state.
    `RowValueBuilder` | `set(byte[] fieldData)` Sets the field data of the current field.
    `RowValueBuilder` | `setFieldIndex(int index)` Sets the index of the current field to populate.
    `RowValue` | `toRowValue(boolean initialize)` Returns the populated `RowValue` and resets the RowValueBuilder.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RowValueBuilder

          public RowValueBuilder(RowDescriptor rowDescriptor)

      Creates instance of RowValueBuilder.
      Parameters:
        `rowDescriptor` - The RowDescriptor for the row(s) to be created

  - ### Method Detail

    - #### setFieldIndex

          public RowValueBuilder setFieldIndex(int index)

      Sets the index of the current field to populate.
      Parameters:
        `index` - Index of the field
      Returns:
        this builder
      Throws:
        `java.lang.IndexOutOfBoundsException` - When `index` is not between 0 (inclusive) and `getSize()` (exclusive)

    - #### at

          public RowValueBuilder at(int index)

      Convenience shortcut for `setFieldIndex(int)`.
      Parameters:
        `index` - Index
      Returns:
        this builder
      See Also:
        `setFieldIndex(int)`

    - #### set

          public RowValueBuilder set(byte[] fieldData)

      Sets the field data of the current field.
      Parameters:
        `fieldData` - Data
      Returns:
        this builder

    - #### get

          public byte[] get(int index)

      Retrieves the field data set at the specified index.
      Parameters:
        `index` - Index
      Returns:
        The field data
      Throws:
        `java.lang.IndexOutOfBoundsException` - When `index` is not between 0 (inclusive) and `getSize()` (exclusive)

    - #### resetField

          public RowValueBuilder resetField()

      Resets to current field to its default uninitialized state.
      Returns:
        this builder

    - #### reset

          public RowValueBuilder reset()

      Resets this builder to a new RowValue. All previous values set are cleared.

      Not to be confused with `resetField()`.

      Returns:
        this builder.

    - #### getSize

          public int getSize()

      Returns:
        Number of fields in the row

    - #### toRowValue

          public RowValue toRowValue(boolean initialize)

      Returns the populated `RowValue` and resets the RowValueBuilder.
      Parameters:
        `initialize` - `true` set field data to null for all uninitialized `FieldValue`, `false` leaves to fields uninitialized. In most cases you want to use `true`.
      Returns:
        The row value object
      See Also:
        `reset()`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.