Class DataRowLayout.Reader

java.lang.Object
org.apache.cayenne.DataRowLayout.Reader
Enclosing class:
DataRowLayout

public static final class DataRowLayout.Reader extends Object
Reads the columns of a layout from rows of any layouts. A row of the reader's own layout is read by position. A row of another layout has the reader's column names resolved to positions in it, which the reader keeps until it reads a row of yet another layout, so a loop over a result set resolves the positions once.

A reader is thus a per-execution object: one is created per query execution, or per other loop over the rows of one result set, and not shared across them. It may still be shared between threads: the resolved positions are kept as one immutable pair, and the race of two threads resolving them costs a repeated resolution only.

Since:
5.0
  • Method Details

    • get

      public Object get(DataRow row, int i)
      Returns the value of the i-th column of the reader's layout in the row, or null if the row has no such column. A null is told from a missing column with has(DataRow, int).
    • has

      public boolean has(DataRow row, int i)
      Returns whether the row has the i-th column of the reader's layout.
    • toString

      public String toString()
      Overrides:
      toString in class Object