public abstract class Traversr<DataType> extends Object
| Constructor and Description |
|---|
Traversr(List<String> paths)
Constructor where we provide a known good set of pathElement Strings in a list.
|
Traversr(String humanPath) |
| Modifier and Type | Method and Description |
|---|---|
Optional<DataType> |
get(Object tree,
List<String> keys)
Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed
for the traversal.
|
abstract Optional<DataType> |
handleFinalSet(TraversalStep traversalStep,
Object tree,
String key,
DataType data)
Allow subclasses to control how "sets" are done, if/once the traversal has made it to the the last element.
|
abstract Optional<DataType> |
handleIntermediateGet(TraversalStep traversalStep,
Object tree,
String key,
TraversalStep.Operation op)
Allow subclasses to control how gets are handled for intermediate traversals.
|
Optional<DataType> |
remove(Object tree,
List<String> keys)
Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed
for the traversal.
|
Optional<DataType> |
set(Object tree,
List<String> keys,
DataType data) |
public Traversr(String humanPath)
public Optional<DataType> get(Object tree, List<String> keys)
public Optional<DataType> set(Object tree, List<String> keys, DataType data)
tree - tree of Map and List JSON structure to navigatedata - JSON style data object you want to setpublic Optional<DataType> remove(Object tree, List<String> keys)
public abstract Optional<DataType> handleFinalSet(TraversalStep traversalStep, Object tree, String key, DataType data)
public abstract Optional<DataType> handleIntermediateGet(TraversalStep traversalStep, Object tree, String key, TraversalStep.Operation op)
Copyright © 2023. All rights reserved.