Package org.apache.groovy.json.internal
Class LazyValueMap
- java.lang.Object
- 
- java.util.AbstractMap<java.lang.String,java.lang.Object>
- 
- org.apache.groovy.json.internal.LazyValueMap
 
 
- 
- All Implemented Interfaces:
- java.util.Map<java.lang.String,java.lang.Object>,- ValueMap<java.lang.String,java.lang.Object>
 
 public class LazyValueMap extends java.util.AbstractMap<java.lang.String,java.lang.Object> implements ValueMap<java.lang.String,java.lang.Object> This class is important to the performance of the parser. It stores Value objects in a map where they are evaluated lazily. This is great for JSONPath types of application, and Object Serialization but not for maps that are going to be stored in a cache. This is because the Value construct is a type of index overlay that merely tracks where the token is located in the buffer, and what if any thing we noted about it (like can be converted to a decimal number, etc.). To mitigate memory leaks this class along with CharSequenceValue implement two constructs, namely, chop, and lazyChop. A chop is when we convert backing buffer of a Value object into a smaller buffer. A lazyChop is when we do a chop but only when a get operation is called. The lazyChop is performed on the tree that is touched by the JSONPath expression or its ilk. The chop operation can be done during parsing or lazily by storing the values in this construct.
- 
- 
Constructor SummaryConstructors Constructor Description LazyValueMap(boolean lazyChop)LazyValueMap(boolean lazyChop, int initialSize)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(MapItemValue miv)Adds a new MapItemValue to the mapping.voidchopMap()Chop this map.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>entrySet()java.lang.Objectget(java.lang.Object key)Gets the item by key from the mapping.booleanhydrated()Has the map been hydrated.java.util.Map.Entry<java.lang.String,Value>[]items()Give me the items in the map without hydrating the map.intlen()Return size w/o hydrating the map.Valueput(java.lang.String key, java.lang.Object value)intsize()java.lang.StringtoString()java.util.Collection<java.lang.Object>values()- 
Methods inherited from class java.util.AbstractMapclear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove
 
- 
 
- 
- 
- 
Method Detail- 
addpublic final void add(MapItemValue miv) Adds a new MapItemValue to the mapping.
 - 
getpublic final java.lang.Object get(java.lang.Object key) Gets the item by key from the mapping.- Specified by:
- getin interface- java.util.Map<java.lang.String,java.lang.Object>
- Overrides:
- getin class- java.util.AbstractMap<java.lang.String,java.lang.Object>
- Parameters:
- key- to lookup
- Returns:
- the item for the given key
 
 - 
chopMappublic final void chopMap() Chop this map.
 - 
putpublic Value put(java.lang.String key, java.lang.Object value) - Specified by:
- putin interface- java.util.Map<java.lang.String,java.lang.Object>
- Overrides:
- putin class- java.util.AbstractMap<java.lang.String,java.lang.Object>
 
 - 
entrySetpublic java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet() - Specified by:
- entrySetin interface- java.util.Map<java.lang.String,java.lang.Object>
- Specified by:
- entrySetin class- java.util.AbstractMap<java.lang.String,java.lang.Object>
 
 - 
valuespublic java.util.Collection<java.lang.Object> values() - Specified by:
- valuesin interface- java.util.Map<java.lang.String,java.lang.Object>
- Overrides:
- valuesin class- java.util.AbstractMap<java.lang.String,java.lang.Object>
 
 - 
sizepublic int size() - Specified by:
- sizein interface- java.util.Map<java.lang.String,java.lang.Object>
- Overrides:
- sizein class- java.util.AbstractMap<java.lang.String,java.lang.Object>
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.util.AbstractMap<java.lang.String,java.lang.Object>
 
 - 
lenpublic int len() Description copied from interface:ValueMapReturn size w/o hydrating the map.
 - 
hydratedpublic boolean hydrated() Description copied from interface:ValueMapHas the map been hydrated.
 
- 
 
-