public static class Jsonya.Navigator<T extends java.util.Map<?,?>>
extends java.lang.Object
| Constructor and Description | 
|---|
| Jsonya.Navigator(java.lang.Object backingStore,
                java.lang.Class<? extends java.util.Map> mapType) | 
| Modifier and Type | Method and Description | 
|---|---|
| Jsonya.Navigator<T> | add(java.lang.Object o1,
   java.lang.Object... others)adds the given items to the focus, whether a list or a map,
 creating the focus as a map if it doesn't already exist. | 
| Jsonya.Navigator<T> | addUnflattened(java.lang.Object o1,
              java.lang.Object... others)adds the given arguments to a list at this point (will not descend into maps, and will not flatten lists) | 
| Jsonya.Navigator<T> | at(java.lang.Object pathSegment,
  java.lang.Object... furtherPathSegments)returns the navigator moved to focus at the indicated key sequence in the given map | 
| Jsonya.Navigator<T> | atArray(java.lang.Object[] furtherPathSegments) | 
| java.lang.Object | get()returns the object at the focus, or null if none | 
| <V> V | get(java.lang.Class<V> type)returns the object at the focus, casted to the given type, null if none | 
| java.lang.Object | get(java.lang.Object pathSegment,
   java.lang.Object... furtherPathSegments)gets the object at the indicated path from the current focus
 (without changing the path to that focus; use  at(Object, Object...)to change focus) | 
| T | getFocusMap()returns a  Mapat the given focus, creating if needed (so never null),
 throwing if it exists already and is not a map | 
| Maybe<T> | getFocusMapMaybe()as  getFocusMap()but always wrapped in aMaybe, absent if null | 
| Maybe<java.lang.Object> | getMaybe() | 
| <V> Maybe<V> | getMaybe(java.lang.Class<V> type)as  get(Class)but always wrapped in aMaybe, absent if null | 
| java.lang.Object | getRoot()returns the object at the root | 
| T | getRootMap()returns the  Mapat the root, throwing if root is not a map | 
| Jsonya.Navigator<T> | list()ensures the given focus is a list | 
| Jsonya.Navigator<T> | map()ensures the given focus is a map, creating if needed (and creating inside the list if it is in a list) | 
| Jsonya.Navigator<T> | pop()pops the most recently pushed focus, so that it returns to the last location  push()ed | 
| Jsonya.Navigator<T> | push()pushes the current focus to a stack, so that this location will be restored on the corresponding  pop() | 
| Jsonya.Navigator<T> | put(java.util.Map map)as  put(Object, Object, Object...)for the kv-pairs in the given map; ignores null for convenience | 
| Jsonya.Navigator<T> | put(java.lang.Object k1,
   java.lang.Object v1,
   java.lang.Object... kvOthers)puts the given key-value pair at the current focus (or multiple such), 
  creating a map if needed, replacing any values stored against keys supplied here;
  if you wish to merge deep maps, see  add(Object, Object...) | 
| Jsonya.Navigator<T> | putIfNotNull(java.lang.Object k1,
            java.lang.Object v1) | 
| Jsonya.Navigator<T> | root() | 
| java.lang.String | toString()Returns JSON serialized output for given focus in the given jsonya;
 applies a naive toString for specialized types | 
| Jsonya.Navigator<T> | useTranslator(com.google.common.base.Function<java.lang.Object,java.lang.Object> translator)specifies a translator function to use when new data is added;
 by default everything is added as a literal (ie  Functions.identity()), 
 but if you want to do translation on the way in,
 set a translation function | 
public Jsonya.Navigator(java.lang.Object backingStore,
                java.lang.Class<? extends java.util.Map> mapType)
public java.lang.Object get()
@Nonnull public Maybe<java.lang.Object> getMaybe()
public <V> V get(java.lang.Class<V> type)
java.lang.ClassCastException - if object exists here but of the wrong type@Nonnull public <V> Maybe<V> getMaybe(java.lang.Class<V> type)
get(Class) but always wrapped in a Maybe, absent if nulljava.lang.ClassCastException - if object exists here but of the wrong typepublic java.lang.Object get(java.lang.Object pathSegment,
                   java.lang.Object... furtherPathSegments)
at(Object, Object...) to change focus)public Jsonya.Navigator<T> root()
public java.lang.Object getRoot()
public T getRootMap()
Map at the root, throwing if root is not a mappublic T getFocusMap()
Map at the given focus, creating if needed (so never null),
 throwing if it exists already and is not a map@Nonnull public Maybe<T> getFocusMapMaybe()
getFocusMap() but always wrapped in a Maybe, absent if nulljava.lang.ClassCastException - if object exists here but of the wrong typepublic Jsonya.Navigator<T> useTranslator(com.google.common.base.Function<java.lang.Object,java.lang.Object> translator)
Functions.identity()), 
 but if you want to do translation on the way in,
 set a translation function
 note that translation should be idempotent as implementation may apply it multiple times in certain cases
public Jsonya.Navigator<T> push()
pop()public Jsonya.Navigator<T> pop()
push()edpublic Jsonya.Navigator<T> at(java.lang.Object pathSegment, java.lang.Object... furtherPathSegments)
public Jsonya.Navigator<T> atArray(java.lang.Object[] furtherPathSegments)
public Jsonya.Navigator<T> map()
public Jsonya.Navigator<T> put(java.lang.Object k1, java.lang.Object v1, java.lang.Object... kvOthers)
add(Object, Object...)public Jsonya.Navigator<T> putIfNotNull(java.lang.Object k1, java.lang.Object v1)
public Jsonya.Navigator<T> put(java.util.Map map)
put(Object, Object, Object...) for the kv-pairs in the given map; ignores null for conveniencepublic Jsonya.Navigator<T> list()
public Jsonya.Navigator<T> add(java.lang.Object o1, java.lang.Object... others)
list().
 
 when adding items to a list, iterable and array arguments are flattened because 
 that makes the most sense when working with deep maps (adding one map to another where both contain lists, for example); 
 to prevent flattening use addUnflattened(Object, Object...) 
 
when adding to a map, arguments will be treated as things to put into the map, accepting either multiple arguments, as key1, value1, key2, value2, ... (and must be an event number); or a single argument which must be a map, in which case the value for each key in the supplied map is added to any existing value against that key in the target map (in other words, it will do a "deep put", where nested maps are effectively merged)
this implementation will currently throw if you attempt to add a non-map to anything present which is not a list; auto-conversion to a list may be added in a future version
public Jsonya.Navigator<T> addUnflattened(java.lang.Object o1, java.lang.Object... others)
public java.lang.String toString()
toString in class java.lang.Object