Record Class ListBlock

java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.block.ListBlock
Record Components:
items - item content in display order; null outer/inner lists are preserved for validation
ordered - true for numbered labels, false for bullets
style - optional list style inherited by each item and its runs
contentItems - optional hierarchical items; supply this or legacy items, never both
All Implemented Interfaces:
Block

public record ListBlock(List<List<TextRun>> items, boolean ordered, Style style, List<ListItem> contentItems) extends Record implements Block
Ordered or bulleted list with one sequence of text runs per item. Ordered labels start at 1; unordered labels are bullets. Items are kept together on a page when possible. Generation requires at least one item and at least one valid text run in every item.
  • Constructor Details

    • ListBlock

      public ListBlock(List<List<TextRun>> items, boolean ordered, Style style, List<ListItem> contentItems)
      Snapshots the outer list and every nonnull item list into unmodifiable lists. Null lists and run entries remain available for generation-time validation.
      Parameters:
      items - item lists to snapshot, or null
      ordered - whether to number the items
      style - optional inherited-style overrides
      contentItems - optional hierarchical item source
    • ListBlock

      public ListBlock(List<List<TextRun>> items, boolean ordered, Style style)
      Preserves the original flat-list constructor and its unchanged inline-item semantics.
      Parameters:
      items - owned flat inline items
      ordered - whether labels are numbered
      style - nullable list typography and spacing
  • Method Details

    • nested

      public static ListBlock nested(List<ListItem> items, boolean ordered, Style style)
      Creates hierarchical items whose child lists follow their inline content.
      Parameters:
      items - structured items, snapshotted immediately
      ordered - whether labels are numbered
      style - nullable list typography and spacing
      Returns:
      immutable hierarchical list
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • items

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

      public boolean ordered()
      Returns the value of the ordered record component.
      Returns:
      the value of the ordered 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
    • contentItems

      public List<ListItem> contentItems()
      Returns the value of the contentItems record component.
      Returns:
      the value of the contentItems record component