public class LazyValueMap extends AbstractMap implements ValueMap
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 and description |
---|
LazyValueMap
(boolean lazyChop) |
LazyValueMap
(boolean lazyChop, int initialSize) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
add(MapItemValue miv) Adds a new MapItemValue to the mapping. |
|
void |
chopMap() Chop this map. |
|
Set<Entry<String, Object>> |
entrySet() |
|
Object |
get(Object key) Gets the item by key from the mapping. |
|
boolean |
hydrated() |
|
Entry<String, Value>[] |
items() |
|
int |
len() |
|
Value |
put(String key, Object value) |
|
int |
size() |
|
String |
toString() |
|
Collection<Object> |
values() |
Methods inherited from class | Name |
---|---|
class AbstractMap |
remove, get, put, equals, toString, values, hashCode, clear, isEmpty, size, entrySet, putAll, containsKey, containsValue, keySet, wait, wait, wait, getClass, notify, notifyAll, remove, replace, replace, replaceAll, merge, putIfAbsent, compute, forEach, computeIfAbsent, getOrDefault, computeIfPresent |
Adds a new MapItemValue to the mapping.
miv
- miv we are adding.Chop this map.
Gets the item by key from the mapping.
key
- to lookupCopyright © 2003-2020 The Apache Software Foundation. All rights reserved.