Package com.fasterxml.jackson.core.json
Class DupDetector
- java.lang.Object
-
- com.fasterxml.jackson.core.json.DupDetector
-
public class DupDetector extends java.lang.Object
Helper class used ifJsonParser.Feature.STRICT_DUPLICATE_DETECTION
is enabled. Optimized to try to limit memory usage and processing overhead for smallest entries, but without adding trashing (immutable objects would achieve optimal memory usage but lead to significant number of discarded temp objects for scopes with large number of entries). Another consideration is trying to limit actual number of compiled classes as it contributes significantly to overall jar size (due to linkage etc).- Since:
- 2.3
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_firstName
protected java.lang.String
_secondName
protected java.util.HashSet<java.lang.String>
_seen
Lazily constructed set of names already seen within this context.protected java.lang.Object
_source
We need to store a back-reference here to parser/generator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DupDetector
child()
JsonLocation
findLocation()
java.lang.Object
getSource()
boolean
isDup(java.lang.String name)
Method called to check whether a newly encountered property name would be a duplicate within this context, and if not, update the state to remember having seen the property name for checking more property namesvoid
reset()
static DupDetector
rootDetector(JsonGenerator g)
static DupDetector
rootDetector(JsonParser p)
-
-
-
Field Detail
-
_source
protected final java.lang.Object _source
We need to store a back-reference here to parser/generator.
-
_firstName
protected java.lang.String _firstName
-
_secondName
protected java.lang.String _secondName
-
_seen
protected java.util.HashSet<java.lang.String> _seen
Lazily constructed set of names already seen within this context.
-
-
Method Detail
-
rootDetector
public static DupDetector rootDetector(JsonParser p)
-
rootDetector
public static DupDetector rootDetector(JsonGenerator g)
-
child
public DupDetector child()
-
reset
public void reset()
-
findLocation
public JsonLocation findLocation()
-
getSource
public java.lang.Object getSource()
- Returns:
- Source object (parser / generator) used to construct this detector
- Since:
- 2.7
-
isDup
public boolean isDup(java.lang.String name) throws JsonParseException
Method called to check whether a newly encountered property name would be a duplicate within this context, and if not, update the state to remember having seen the property name for checking more property names- Parameters:
name
- Property seen- Returns:
True
if the property had already been seen before in this context- Throws:
JsonParseException
- to report possible operation problem (default implementation never throws it)
-
-