Package com.fasterxml.jackson.jr.ob.impl
Class JSONReader
java.lang.Object
com.fasterxml.jackson.jr.ob.impl.JSONReader
Root-level helper object that handles initial delegation to actual
readers (which are
ValueReaders), but does not handle
any of reading itself (despite name).
Life-cycle is such that initial instance (called blueprint)
is constructed first (including possible configuration
using mutant factory methods). This blueprint object
acts as a factory, and is never used for direct reading;
instead, per-call instance is created by calling
perOperationInstance(int, com.fasterxml.jackson.jr.ob.impl.ValueReaderLocator, com.fasterxml.jackson.core.TreeCodec, com.fasterxml.jackson.core.JsonParser).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CollectionBuilderHandler that takes care of constructingMaps as neededprotected final intprotected final MapBuilderHandler that takes care of constructingMaps as neededprotected final com.fasterxml.jackson.core.JsonParserParser used by this reader instance.protected final ValueReaderLocatorObject that is used to find value readers dynamically.protected final Object[]Minor performance optimization:Object[1]reused to avoid Reflection having to allocate it for every "setter" call.protected final com.fasterxml.jackson.core.TreeCodecConfiguredTreeCodecthat is needed if values of typeTreeNodeare to be read. -
Constructor Summary
ConstructorsModifierConstructorDescriptionJSONReader(CollectionBuilder lb, MapBuilder mb) Constructor used for creating the blueprint instances.protectedJSONReader(JSONReader base, int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p) Constructor used for per-operation (non-blueprint) instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected CollectionBuilder_collectionBuilder(Class<?> collType) protected MapBuilder_mapBuilder(Class<?> mapType) protected JSONReader_with(CollectionBuilder lb, MapBuilder mb) Overridable method that all mutant factories call if a new instance is to be constructedbooleanintfeatures()booleanperOperationInstance(int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p) Object[]Method for reading a JSON Array from input and building aObject[]out of it.<T> T[]readArrayOf(Class<T> type) <T> TMethod for reading a JSON Object from input and building a Bean of specified type out of it; Bean has to conform to standard Java Bean specification by having setters for passing JSON Object properties.readList()Method for reading a JSON Array from input and building aListout of it.<T> List<T>readListOf(Class<T> type) Method for reading a JSON Array from input and building aListout of it, binding values into specifiedtype.readMap()Method for reading a JSON Object from input and building aMapout of it.Method for reading a JSON Object from input and building aMapout of it, binding values into specifiedtype.com.fasterxml.jackson.core.TreeNodereadTree()with(MapBuilder mb) withCacheCheck(int features)
-
Field Details
-
_mapBuilder
Handler that takes care of constructingMaps as needed -
_collectionBuilder
Handler that takes care of constructingMaps as needed -
_features
protected final int _features -
_treeCodec
protected final com.fasterxml.jackson.core.TreeCodec _treeCodecConfiguredTreeCodecthat is needed if values of typeTreeNodeare to be read. -
_readerLocator
Object that is used to find value readers dynamically. -
_parser
protected final com.fasterxml.jackson.core.JsonParser _parserParser used by this reader instance. -
_setterBuffer
Minor performance optimization:Object[1]reused to avoid Reflection having to allocate it for every "setter" call.- Since:
- 2.13
-
-
Constructor Details
-
JSONReader
Constructor used for creating the blueprint instances. -
JSONReader
protected JSONReader(JSONReader base, int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p) Constructor used for per-operation (non-blueprint) instance.
-
-
Method Details
-
withCacheCheck
-
with
-
with
-
_with
Overridable method that all mutant factories call if a new instance is to be constructed -
perOperationInstance
public JSONReader perOperationInstance(int features, ValueReaderLocator loc, com.fasterxml.jackson.core.TreeCodec tc, com.fasterxml.jackson.core.JsonParser p) -
arraysAsLists
public boolean arraysAsLists()- Since:
- 2.8
-
isEnabled
- Since:
- 2.11
-
features
public int features()- Since:
- 2.13
-
readValue
Method for reading a "simple" Object of type indicated by JSON content:Mapfor JSON Object,Mapfor JSON Array (or,Object[]if so configured),Stringfor JSON String value and so on.- Throws:
IOException
-
readMap
Method for reading a JSON Object from input and building aMapout of it. Note that if input does NOT contain a JSON Object,JSONObjectExceptionwill be thrown.- Throws:
IOException
-
readList
Method for reading a JSON Array from input and building aListout of it. Note that if input does NOT contain a JSON Array,JSONObjectExceptionwill be thrown.- Throws:
IOException
-
readArray
Method for reading a JSON Array from input and building aObject[]out of it. Note that if input does NOT contain a JSON Array,JSONObjectExceptionwill be thrown.- Throws:
IOException
-
readBean
Method for reading a JSON Object from input and building a Bean of specified type out of it; Bean has to conform to standard Java Bean specification by having setters for passing JSON Object properties.- Throws:
IOException
-
readArrayOf
- Throws:
IOException
-
readListOf
Method for reading a JSON Array from input and building aListout of it, binding values into specifiedtype. Note that if input does NOT contain a JSON Array,JSONObjectExceptionwill be thrown.- Throws:
IOException
-
readMapOf
Method for reading a JSON Object from input and building aMapout of it, binding values into specifiedtype. Note that if input does NOT contain a JSON Object,JSONObjectExceptionwill be thrown.- Throws:
IOException- Since:
- 2.10
-
readTree
- Throws:
IOException- Since:
- 2.11
-
_mapBuilder
-
_collectionBuilder
-