Record Class TableBlock

java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.block.TableBlock
Record Components:
columnWeights - positive relative weights, one per physical column
header - optional single repeating header row, null becomes empty
rows - ordered body rows containing cells at their first unoccupied column
style - nullable table typography and spacing
options - optional appearance and row policies; null preserves legacy defaults
All Implemented Interfaces:
Block

public record TableBlock(List<Double> columnWeights, List<TableCell> header, List<List<TableCell>> rows, Style style, TableOptions options) extends Record implements Block
Full-width native table with positive proportional column weights, an optional repeating header and ordered body rows. Cells can span columns/rows; each section must cover its complete grid without holes or overlap, and header spans cannot enter the body. Cell text inherits table, cell and run styles in that order. Rich cells also support ordinary paragraphs, lists and images.
  • Constructor Details

    • TableBlock

      public TableBlock(List<Double> columnWeights, List<TableCell> header, List<List<TableCell>> rows, Style style, TableOptions options)
      Snapshots all supplied collections, retaining null rows and entries for field-path errors.
      Parameters:
      columnWeights - nullable relative column widths
      header - nullable repeating header
      rows - nullable body rows
      style - nullable table style
      options - nullable appearance and row policies
    • TableBlock

      public TableBlock(List<Double> columnWeights, List<TableCell> header, List<List<TableCell>> rows, Style style)
      Preserves the original constructor with legacy cell appearance and row keeps.
      Parameters:
      columnWeights - relative positive weights
      header - optional repeating header
      rows - ordered body rows
      style - nullable table style
  • Method Details

    • withStyle

      public TableBlock withStyle(Style value)
      Replaces typography while preserving spans, content, appearance and row metadata.
      Parameters:
      value - nullable replacement table style
      Returns:
      immutable restyled table
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • columnWeights

      public List<Double> columnWeights()
      Returns the value of the columnWeights record component.
      Returns:
      the value of the columnWeights record component
    • header

      public List<TableCell> header()
      Returns the value of the header record component.
      Returns:
      the value of the header record component
    • rows

      public List<List<TableCell>> rows()
      Returns the value of the rows record component.
      Returns:
      the value of the rows record component
    • style

      public Style style()
      Returns the value of the style record component.
      Specified by:
      style in interface Block
      Returns:
      the value of the style record component
    • options

      public TableOptions options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component