Class LazyValueMap

java.lang.Object
java.util.AbstractMap<String,​Object>
org.apache.groovy.json.internal.LazyValueMap
All Implemented Interfaces:
Map<String,​Object>, ValueMap<String,​Object>

public class LazyValueMap
extends AbstractMap<String,​Object>
implements ValueMap<String,​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.