TreeAdapter

Provides the parent/child relationship information between pojos to derive a tree-structure.

API

TreeAdapter.java
interface TreeAdapter<T> {
  int childCountOf(T value)     (1)
  Stream<T> childrenOf(T value)     (2)
  Optional<T> resolveRelative(T node, TreePath relativePath)     (3)
}
1 childCountOf(T)
2 childrenOf(T)
3 resolveRelative(T, TreePath)

Resolves given TreePath to its corresponding sub-node relative to given node if possible.

Members

childCountOf(T)

childrenOf(T)

resolveRelative(T, TreePath)

Resolves given TreePath to its corresponding sub-node relative to given node if possible.

E.g. starting from root, '/0' will return the root;starting from root, '/0/2' will return the 3rd child of root;starting from sub-node '/0/2', '/2/9' will resolve the 10th child ('/0/2/9') of this sub-node