Record Class TableCell

java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.table.TableCell
Record Components:
runs - optional nonempty ordered inline content; exclusive with blocks
style - nullable typography layered after the table style
backgroundColor - legacy optional six-digit RGB fill, overriding appearance fill
blocks - optional block content; an empty list creates an empty cell
columnSpan - optional positive column span, null means one
rowSpan - optional positive row span, null means one
appearance - optional cell appearance overrides
semanticStyle - optional tag defaults below themes and explicit cell styles
defaultAppearance - optional semantic appearance below theme and explicit table defaults

public record TableCell(List<TextRun> runs, Style style, String backgroundColor, List<Block> blocks, Integer columnSpan, Integer rowSpan, CellAppearance appearance, Style semanticStyle, CellAppearance defaultAppearance) extends Record
Cell containing either inline runs or ordinary blocks. Runs retain the compact legacy form; blocks support paragraphs, headings, lists and images, with no nested tables or page breaks. Exactly one form must be supplied. An empty block list explicitly represents an empty visual cell. Span and appearance checks occur during generation.
  • Constructor Details

    • TableCell

      public TableCell(List<TextRun> runs, Style style, String backgroundColor, List<Block> blocks, Integer columnSpan, Integer rowSpan, CellAppearance appearance, Style semanticStyle)
      Preserves cells with tag-specific typography and no appearance fallback.
      Parameters:
      runs - inline content
      style - local typography
      backgroundColor - explicit fill
      blocks - rich content
      columnSpan - occupied columns
      rowSpan - occupied rows
      appearance - explicit appearance
      semanticStyle - default typography
    • TableCell

      public TableCell(List<TextRun> runs, Style style, String backgroundColor, List<Block> blocks, Integer columnSpan, Integer rowSpan, CellAppearance appearance)
      Creates a rich cell without tag-specific semantic defaults.
      Parameters:
      runs - nullable inline content
      style - nullable explicit cell typography
      backgroundColor - optional fill
      blocks - nullable rich content
      columnSpan - nullable positive column span
      rowSpan - nullable positive row span
      appearance - optional border/padding/alignment/fill
    • TableCell

      public TableCell(List<TextRun> runs, Style style, String backgroundColor, List<Block> blocks, Integer columnSpan, Integer rowSpan, CellAppearance appearance, Style semanticStyle, CellAppearance defaultAppearance)
      Copies both content lists without validating their entries or exclusive content forms.
      Parameters:
      runs - nullable inline runs
      style - nullable cell style
      backgroundColor - nullable legacy cell fill
      blocks - nullable block list
      columnSpan - nullable column span
      rowSpan - nullable row span
      appearance - nullable local appearance
      semanticStyle - nullable tag defaults
      defaultAppearance - nullable builtin appearance
    • TableCell

      public TableCell(List<TextRun> runs, Style style, String backgroundColor)
      Creates a legacy text-only cell with one-column/one-row spans and default appearance.
      Parameters:
      runs - ordered cell runs
      style - nullable text overrides
      backgroundColor - nullable six-digit RGB fill
  • Method Details

    • text

      public static TableCell text(String text)
      Wraps plain text, including an empty string, in a compact cell.
      Parameters:
      text - cell text, validated during generation
      Returns:
      immutable cell with a single plain run
    • content

      public static TableCell content(List<Block> content)
      Creates a block-content cell; an empty list creates an explicit empty cell.
      Parameters:
      content - cell blocks, snapshotted and validated during generation
      Returns:
      immutable rich cell
    • span

      public TableCell span(int columns, int rows)
      Returns this cell with explicit spans, preserving content and appearance.
      Parameters:
      columns - number of occupied columns, positive at generation
      rows - number of occupied rows, positive at generation
      Returns:
      immutable spanned copy
    • withStyle

      public TableCell withStyle(Style value)
      Returns a copy with replacement typography and all geometry/content retained.
      Parameters:
      value - nullable cell typography
      Returns:
      immutable restyled cell
    • withAppearance

      public TableCell withAppearance(CellAppearance value)
      Returns a copy with replacement local appearance and all other properties retained.
      Parameters:
      value - nullable local appearance
      Returns:
      immutable copy
    • 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.
    • runs

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

      public Style style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component
    • backgroundColor

      public String backgroundColor()
      Returns the value of the backgroundColor record component.
      Returns:
      the value of the backgroundColor record component
    • blocks

      public List<Block> blocks()
      Returns the value of the blocks record component.
      Returns:
      the value of the blocks record component
    • columnSpan

      public Integer columnSpan()
      Returns the value of the columnSpan record component.
      Returns:
      the value of the columnSpan record component
    • rowSpan

      public Integer rowSpan()
      Returns the value of the rowSpan record component.
      Returns:
      the value of the rowSpan record component
    • appearance

      public CellAppearance appearance()
      Returns the value of the appearance record component.
      Returns:
      the value of the appearance record component
    • semanticStyle

      public Style semanticStyle()
      Returns the value of the semanticStyle record component.
      Returns:
      the value of the semanticStyle record component
    • defaultAppearance

      public CellAppearance defaultAppearance()
      Returns the value of the defaultAppearance record component.
      Returns:
      the value of the defaultAppearance record component