- java.lang.Object
-
- net.minidev.json.actions.navigate.TreeNavigator<M,L>
-
- Direct Known Subclasses:
JSONNavigator
public class TreeNavigator<M extends Map<String,Object>,L extends List<Object>> extends Object
Navigates only the branches of aJSONObjectcorresponding to the paths specified.For each specified path to navigate, the
TreeNavigatoronly traverses the matching branch.The navigator accepts an action and provides callback hooks for it to act on the traversed nodes at each significant step. See
NavigateAction.See package-info for more details
Example:
To navigate the branch k1.k2 of the object {"k1":{"k2":"v1"}, "k3":{"k4":"v2"}} instantiate the navigator like so: new JSONNavigator("k1.k2")
- Since:
- 15 June 2016.
- Author:
- adoneitan@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description protected NavigateAction<M,L>actionprotected StringpathPrefixprotected List<String>pathsToNavigate
-
Constructor Summary
Constructors Constructor Description TreeNavigator(NavigateAction<M,L> action, String... pathsToNavigate)TreeNavigator(NavigateAction<M,L> action, List<String> pathsToNavigate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnav(M object)voidnav(TreePath jp, L list)voidnav(TreePath jp, M map)TreeNavigator<M,L>with(String pathPrefix)
-
-
-
Constructor Detail
-
TreeNavigator
public TreeNavigator(NavigateAction<M,L> action, List<String> pathsToNavigate)
-
TreeNavigator
public TreeNavigator(NavigateAction<M,L> action, String... pathsToNavigate)
-
-