Package org.apache.juneau.commons.svl
Class Structure
java.lang.Object
org.apache.juneau.commons.svl.Structure
A typed, structured value (list, block or table) that an SVL expression function can return.
The core never emits markup. toString() gives a plain-text fallback; a layer that understands richer
output (such as the J0439 template layer) interprets kind(), items() / rows() and
options() itself.
Instances are immutable; all inputs are defensively copied (shallow: the elements themselves are not copied).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic StructureCreates a block holding a single content item.static StructureCreates a block with options.columns()Returns the column headers of a table.List<?>items()Returns the items of a list or block.kind()Returns the kind of this structure.static StructureCreates an ordered list.static StructureCreates an ordered list with options.options()Returns the layer-defined options.rows()Returns the rows of a table.static StructureCreates a table.static StructureCreates a table with options.toString()Plain-text fallback.static StructureCreates an unordered list.static StructureCreates an unordered list with options.
-
Method Details
-
ul
Creates an unordered list.- Parameters:
items- The items. Must not benull .- Returns:
- A new structure.
-
ul
Creates an unordered list with options.- Parameters:
items- The items. Must not benull .options- Layer-defined options. May benull .- Returns:
- A new structure.
-
ol
Creates an ordered list.- Parameters:
items- The items. Must not benull .- Returns:
- A new structure.
-
ol
Creates an ordered list with options.- Parameters:
items- The items. Must not benull .options- Layer-defined options. May benull .- Returns:
- A new structure.
-
block
Creates a block holding a single content item.- Parameters:
content- The content. May benull .- Returns:
- A new structure.
-
block
Creates a block with options.- Parameters:
content- The content. May benull .options- Layer-defined options. May benull .- Returns:
- A new structure.
-
table
Creates a table.- Parameters:
columns- The column headers. Must not benull .rows- The rows. Must not benull .- Returns:
- A new structure.
-
table
Creates a table with options.- Parameters:
columns- The column headers. Must not benull .rows- The rows. Must not benull .options- Layer-defined options. May benull .- Returns:
- A new structure.
-
kind
Returns the kind of this structure.- Returns:
- The kind.
-
items
Returns the items of a list or block.- Returns:
- An unmodifiable list, or an empty list for a table.
-
columns
Returns the column headers of a table.- Returns:
- An unmodifiable list, or an empty list for a non-table.
-
rows
Returns the rows of a table.- Returns:
- An unmodifiable list, or an empty list for a non-table.
-
options
Returns the layer-defined options.- Returns:
- An unmodifiable map; never
null .
-
toString
Plain-text fallback.Lists render one item per line prefixed with
- orN. ; a block renders its content; a table renders the header and then each row as tab-separated values, one per line.
-