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 validationordered- true for numbered labels, false for bulletsstyle- optional list style inherited by each item and its runscontentItems- 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 Summary
ConstructorsConstructorDescriptionPreserves the original flat-list constructor and its unchanged inline-item semantics.Snapshots the outer list and every nonnull item list into unmodifiable lists. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontentItemsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.items()Returns the value of theitemsrecord component.static ListBlockCreates hierarchical items whose child lists follow their inline content.booleanordered()Returns the value of theorderedrecord component.style()Returns the value of thestylerecord component.final StringtoString()Returns a string representation of this record class.
-
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 nullordered- whether to number the itemsstyle- optional inherited-style overridescontentItems- optional hierarchical item source
-
ListBlock
Preserves the original flat-list constructor and its unchanged inline-item semantics.- Parameters:
items- owned flat inline itemsordered- whether labels are numberedstyle- nullable list typography and spacing
-
-
Method Details
-
nested
Creates hierarchical items whose child lists follow their inline content.- Parameters:
items- structured items, snapshotted immediatelyordered- whether labels are numberedstyle- nullable list typography and spacing- Returns:
- immutable hierarchical list
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
items
Returns the value of theitemsrecord component.- Returns:
- the value of the
itemsrecord component
-
ordered
public boolean ordered()Returns the value of theorderedrecord component.- Returns:
- the value of the
orderedrecord component
-
style
Returns the value of thestylerecord component. -
contentItems
Returns the value of thecontentItemsrecord component.- Returns:
- the value of the
contentItemsrecord component
-