Class DataRowLayout
java.lang.Object
org.apache.cayenne.DataRowLayout
- All Implemented Interfaces:
Serializable
The layout of a
DataRow: the column names in column order, with a lookup of a name to its position. A row
holds its values by position in its layout, and all the rows of one result set share a layout. Layouts are
immutable and compared by identity, so two rows share a layout only when they came from the same reader. A layout
is serializable, and the rows serialized in one stream keep sharing theirs.
A consumer that needs a fixed set of columns from rows of any layouts builds a layout of those names and reads
them through a DataRowLayout.Reader of it.
- Since:
- 5.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classReads the columns of a layout from rows of any layouts. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the position of the named column, or -1 if there is no such column.nameAt(int index) Returns the name of the column at the given position.static DataRowLayoutReturns a layout of the given column names, in the given order.reader()Returns a reader of the columns of this layout from rows of any layouts.intsize()Returns the number of columns.toString()
-
Method Details
-
of
Returns a layout of the given column names, in the given order. A repeated name is deduplicated: the last occurrence keeps the name, the way the last put wins in a map, and each earlier one is renamed with an underscore appended until it is unique. -
size
public int size()Returns the number of columns. -
indexOf
Returns the position of the named column, or -1 if there is no such column. -
nameAt
Returns the name of the column at the given position. -
reader
Returns a reader of the columns of this layout from rows of any layouts. -
toString
-