Package org.openrefine.model
Class RowBuilder
- java.lang.Object
-
- org.openrefine.model.RowBuilder
-
-
Constructor Summary
Constructors Constructor Description RowBuilder(int initialSize)Constructs a new row builder with an expected capacity for cells.RowBuilder(Row initialRow)Constructs a new row builder whose state replicates that of an initial row
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Rowbuild()Builds the row.Rowbuild(int size)Builds the row, ensuring that it has a given final size.static RowBuildercreate(int initialSize)Helper to make instantiation easier.static RowBuilderfromRow(Row initialRow)Helper to make instantiation easier.CellgetCell(int cellIndex)Accesses the existing cells while building the row.RowBuilderwithCell(int index, Cell cell)Sets a cell at a given index.RowBuilderwithFlagged(boolean flagged)Sets the "flagged" parameter on the rowRowBuilderwithStarred(boolean starred)Sets the "starred" parameter on the row
-
-
-
Constructor Detail
-
RowBuilder
public RowBuilder(int initialSize)
Constructs a new row builder with an expected capacity for cells.- Parameters:
initialSize- the expected number of cells in this row
-
RowBuilder
public RowBuilder(Row initialRow)
Constructs a new row builder whose state replicates that of an initial row- Parameters:
initialRow- the row to modify
-
-
Method Detail
-
fromRow
public static RowBuilder fromRow(Row initialRow)
Helper to make instantiation easier.
-
create
public static RowBuilder create(int initialSize)
Helper to make instantiation easier.
-
withStarred
public RowBuilder withStarred(boolean starred)
Sets the "starred" parameter on the row- Parameters:
starred- whether the row is starred or not
-
withFlagged
public RowBuilder withFlagged(boolean flagged)
Sets the "flagged" parameter on the row- Parameters:
flagged- whether the row is flagged or not
-
withCell
public RowBuilder withCell(int index, Cell cell)
Sets a cell at a given index.- Parameters:
index- the index of the column where to add the cellcell- the cell value (can be null)
-
build
public Row build(int size)
Builds the row, ensuring that it has a given final size. The row will be padded by null cells appropriately.- Parameters:
size- the number of cells in the row
-
getCell
public Cell getCell(int cellIndex)
Accesses the existing cells while building the row.- Returns:
- null if out of bounds
-
build
public Row build()
Builds the row.
-
-