E
- ID类型public class TreeBuilder<E> extends Object implements Builder<Tree<E>>
Constructor and Description |
---|
TreeBuilder(E rootId,
TreeNodeConfig config)
构造
|
TreeBuilder(Tree<E> rootNode)
构造
|
Modifier and Type | Method and Description |
---|---|
TreeBuilder<E> |
append(Iterable<Tree<E>> trees)
增加节点列表,增加的节点是不带子节点的
|
<T> TreeBuilder<E> |
append(List<T> list,
E rootId,
NodeParser<T,E> nodeParser)
Deprecated.
rootId参数可以不提供,在root节点中直接获取,请使用
append(List, NodeParser) |
<T> TreeBuilder<E> |
append(List<T> list,
NodeParser<T,E> nodeParser)
增加节点列表,增加的节点是不带子节点的
|
TreeBuilder<E> |
append(Map<E,Tree<E>> map)
增加节点列表,增加的节点是不带子节点的
|
Tree<E> |
build()
构建
|
List<Tree<E>> |
buildList()
构建树列表,没有顶层节点,例如:
-用户管理
-用户管理
+用户添加
- 部门管理
-部门管理
+部门添加
|
static <T> TreeBuilder<T> |
of(T rootId)
创建Tree构建器
|
static <T> TreeBuilder<T> |
of(T rootId,
TreeNodeConfig config)
创建Tree构建器
|
TreeBuilder<E> |
putExtra(String key,
Object value)
扩展属性
|
TreeBuilder<E> |
reset()
重置Builder,实现复用
|
TreeBuilder<E> |
setId(E id)
设置ID
|
TreeBuilder<E> |
setName(CharSequence name)
设置节点标签名称
|
TreeBuilder<E> |
setParentId(E parentId)
设置父节点ID
|
TreeBuilder<E> |
setWeight(Comparable<?> weight)
设置权重
|
public TreeBuilder(E rootId, TreeNodeConfig config)
rootId
- 根节点IDconfig
- 配置public static <T> TreeBuilder<T> of(T rootId)
T
- ID类型rootId
- 根节点IDpublic static <T> TreeBuilder<T> of(T rootId, TreeNodeConfig config)
T
- ID类型rootId
- 根节点IDconfig
- 配置public TreeBuilder<E> setId(E id)
id
- IDpublic TreeBuilder<E> setParentId(E parentId)
parentId
- 父节点IDpublic TreeBuilder<E> setName(CharSequence name)
name
- 节点标签名称public TreeBuilder<E> setWeight(Comparable<?> weight)
weight
- 权重public TreeBuilder<E> putExtra(String key, Object value)
key
- 键value
- 扩展值public TreeBuilder<E> append(Map<E,Tree<E>> map)
map
- 节点列表public TreeBuilder<E> append(Iterable<Tree<E>> trees)
trees
- 节点列表public <T> TreeBuilder<E> append(List<T> list, NodeParser<T,E> nodeParser)
T
- Bean类型list
- Bean列表nodeParser
- 节点转换器,用于定义一个Bean如何转换为Tree节点@Deprecated public <T> TreeBuilder<E> append(List<T> list, E rootId, NodeParser<T,E> nodeParser)
append(List, NodeParser)
T
- Bean类型list
- Bean列表rootId
- 根IDnodeParser
- 节点转换器,用于定义一个Bean如何转换为Tree节点public TreeBuilder<E> reset()
Copyright © 2024. All rights reserved.