public class TreeBuilder extends Object
Constructor and Description |
---|
TreeBuilder() |
Modifier and Type | Method and Description |
---|---|
static List |
buildFromChildIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding childIdsBinding)
Build a tree out a list of rows,
where the tree structure is determined by child-ids bindings
(ie each row contains a field with the ids of its children).
|
static List |
buildFromParentIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding parentIdBinding)
Build a tree out a list of rows,
where the tree structure is determined by parent-id bindings
(ie each row contains a field with the id of its parent).
|
public static List buildFromParentIds(List rows, String rowVariable, ValueBinding rowIdBinding, ValueBinding parentIdBinding)
rows
- List of rows. This may be empty, but not null.rowVariable
- Row variable used in row-id and parent-id bindings.
For example, if the row-id binding is #{row.id}, the row variable is "row".rowIdBinding
- Binding expression that calculates the row-id for the current row.
This must return a unique string id for each row.parentIdBinding
- Binding expression that calculates the parent-id for the current row.
This must return null for rows that represent roots, and a valid parent row-id for all other rows.INode
roots of the tree.
Never null; may be empty if original list of rows was empty.public static List buildFromChildIds(List rows, String rowVariable, ValueBinding rowIdBinding, ValueBinding childIdsBinding)
rows
- List of rows. This may be empty, but not null.rowVariable
- Row variable used in row-id and child-ids bindings.
For example, if the row-id binding is #{row.id}, the row variable is "row".rowIdBinding
- Binding expression that calculates the row-id for the current row.
This must return a unique string id for each row.childIdsBinding
- Binding expression that calculates the child-ids for the current row.
This must return a comma-separated String
of row-ids, a Collection
of row-ids,
an array of String
row-ids, or null. It may return an empty string, collection, or array.INode
roots of the tree.
Never null; may be empty if original list of rows was empty.