Class RowBuilder


  • public class RowBuilder
    extends Object
    Utility class to build Row instances, as they are immutable.
    • 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 cell
        cell - 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.