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 blocksstyle- nullable typography layered after the table stylebackgroundColor- legacy optional six-digit RGB fill, overriding appearance fillblocks- optional block content; an empty list creates an empty cellcolumnSpan- optional positive column span, null means onerowSpan- optional positive row span, null means oneappearance- optional cell appearance overridessemanticStyle- optional tag defaults below themes and explicit cell stylesdefaultAppearance- 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 Summary
ConstructorsConstructorDescriptionCreates a legacy text-only cell with one-column/one-row spans and default appearance.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.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.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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theappearancerecord component.Returns the value of thebackgroundColorrecord component.blocks()Returns the value of theblocksrecord component.Returns the value of thecolumnSpanrecord component.static TableCellCreates a block-content cell; an empty list creates an explicit empty cell.Returns the value of thedefaultAppearancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.rowSpan()Returns the value of therowSpanrecord component.runs()Returns the value of therunsrecord component.Returns the value of thesemanticStylerecord component.span(int columns, int rows) Returns this cell with explicit spans, preserving content and appearance.style()Returns the value of thestylerecord component.static TableCellWraps plain text, including an empty string, in a compact cell.final StringtoString()Returns a string representation of this record class.withAppearance(CellAppearance value) Returns a copy with replacement local appearance and all other properties retained.Returns a copy with replacement typography and all geometry/content retained.
-
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 contentstyle- local typographybackgroundColor- explicit fillblocks- rich contentcolumnSpan- occupied columnsrowSpan- occupied rowsappearance- explicit appearancesemanticStyle- 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 contentstyle- nullable explicit cell typographybackgroundColor- optional fillblocks- nullable rich contentcolumnSpan- nullable positive column spanrowSpan- nullable positive row spanappearance- 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 runsstyle- nullable cell stylebackgroundColor- nullable legacy cell fillblocks- nullable block listcolumnSpan- nullable column spanrowSpan- nullable row spanappearance- nullable local appearancesemanticStyle- nullable tag defaultsdefaultAppearance- nullable builtin appearance
-
TableCell
Creates a legacy text-only cell with one-column/one-row spans and default appearance.- Parameters:
runs- ordered cell runsstyle- nullable text overridesbackgroundColor- nullable six-digit RGB fill
-
-
Method Details
-
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
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
Returns this cell with explicit spans, preserving content and appearance.- Parameters:
columns- number of occupied columns, positive at generationrows- number of occupied rows, positive at generation- Returns:
- immutable spanned copy
-
withStyle
Returns a copy with replacement typography and all geometry/content retained.- Parameters:
value- nullable cell typography- Returns:
- immutable restyled cell
-
withAppearance
Returns a copy with replacement local appearance and all other properties retained.- Parameters:
value- nullable local appearance- Returns:
- immutable copy
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
runs
Returns the value of therunsrecord component.- Returns:
- the value of the
runsrecord component
-
style
Returns the value of thestylerecord component.- Returns:
- the value of the
stylerecord component
-
backgroundColor
Returns the value of thebackgroundColorrecord component.- Returns:
- the value of the
backgroundColorrecord component
-
blocks
Returns the value of theblocksrecord component.- Returns:
- the value of the
blocksrecord component
-
columnSpan
Returns the value of thecolumnSpanrecord component.- Returns:
- the value of the
columnSpanrecord component
-
rowSpan
Returns the value of therowSpanrecord component.- Returns:
- the value of the
rowSpanrecord component
-
appearance
Returns the value of theappearancerecord component.- Returns:
- the value of the
appearancerecord component
-
semanticStyle
Returns the value of thesemanticStylerecord component.- Returns:
- the value of the
semanticStylerecord component
-
defaultAppearance
Returns the value of thedefaultAppearancerecord component.- Returns:
- the value of the
defaultAppearancerecord component
-