Class VirtualTree.Builder<T,ID>

java.lang.Object
cloud.opencode.base.tree.virtual.VirtualTree.Builder<T,ID>
Type Parameters:
T - the data type | 数据类型
ID - the ID type | ID类型
Enclosing class:
VirtualTree<T,ID>

public static class VirtualTree.Builder<T,ID> extends Object
Virtual Tree Builder 虚拟树构建器
Since:
JDK 25, opencode-base-tree V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • id

      public VirtualTree.Builder<T,ID> id(ID id)
      Set node ID 设置节点ID
      Parameters:
      id - the ID | ID
      Returns:
      the builder | 构建器
    • parentId

      public VirtualTree.Builder<T,ID> parentId(ID parentId)
      Set parent ID 设置父节点ID
      Parameters:
      parentId - the parent ID | 父节点ID
      Returns:
      the builder | 构建器
    • data

      public VirtualTree.Builder<T,ID> data(T data)
      Set node data 设置节点数据
      Parameters:
      data - the data | 数据
      Returns:
      the builder | 构建器
    • childLoader

      public VirtualTree.Builder<T,ID> childLoader(LazyChildLoader<VirtualTree<T,ID>, ID> childLoader)
      Set child loader 设置子节点加载器
      Parameters:
      childLoader - the loader | 加载器
      Returns:
      the builder | 构建器
    • nodeCache

      public VirtualTree.Builder<T,ID> nodeCache(Map<ID, VirtualTree<T,ID>> nodeCache)
      Set node cache 设置节点缓存
      Parameters:
      nodeCache - the cache | 缓存
      Returns:
      the builder | 构建器
    • maxCacheSize

      public VirtualTree.Builder<T,ID> maxCacheSize(int maxCacheSize)
      Set max cache size 设置最大缓存大小
      Parameters:
      maxCacheSize - the max size | 最大大小
      Returns:
      the builder | 构建器
    • cacheEnabled

      public VirtualTree.Builder<T,ID> cacheEnabled(boolean cacheEnabled)
      Enable or disable cache 启用或禁用缓存
      Parameters:
      cacheEnabled - whether enabled | 是否启用
      Returns:
      the builder | 构建器
    • build

      public VirtualTree<T,ID> build()
      Build the virtual tree node 构建虚拟树节点
      Returns:
      the node | 节点