Uses "mutant factory" pattern so that instances are immutable
(and thus fully thread-safe with no external synchronization);
new instances are constructed for different configurations.
Instances are initially constructed by ObjectMapper and can be
reused, shared, cached; both because of thread-safety and because
instances are relatively light-weight.
NOTE: this class is NOT meant as sub-classable by users. It is left as non-final mostly to allow frameworks that require byte code generation for proxying and similar use cases, but there is no expectation that functionality should be extended by sub-classing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DeserializationConfigGeneral serialization configuration settings; while immutable, can use copy-constructor to create modified instances as necessary.protected final DeserializationContextsBlueprint instance of deserialization context; used for creating actual instance when needed.protected final InjectableValuesValues that can be injected during deserialization, if any.protected final TokenStreamFactoryFactory used for constructingJsonParsersprotected final ValueDeserializer<Object>We may pre-fetch deserializer as soon as_valueTypeis known, and if so, reuse it afterwards.protected final ConcurrentHashMap<JavaType,ValueDeserializer<Object>> Root-level cached deserializers.protected final FormatSchemaWhen using data format that uses a schema, schema is passed to parser.protected final booleanFlag that indicates whether root values are expected to be unwrapped or notprotected final ObjectInstance to update with data binding; if any.protected final JavaTypeDeclared type of value to instantiate during deserialization.protected static final JavaType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedObjectReader(ObjectMapper mapper, DeserializationConfig config) Constructor used byObjectMapperfor initial instantiationprotectedObjectReader(ObjectMapper mapper, DeserializationConfig config, JavaType valueType, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Constructor called when a root deserializer should be fetched based on other configuration.protectedObjectReader(ObjectReader base, TokenFilter filter) protectedObjectReader(ObjectReader base, DeserializationConfig config) Copy constructor used when modifying simple feature flagsprotectedObjectReader(ObjectReader base, DeserializationConfig config, JavaType valueType, ValueDeserializer<Object> rootDeser, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Copy constructor used for building variations. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void_assertNotNull(String paramName, Object src) protected Object_bind(DeserializationContextExt ctxt, JsonParser p, Object valueToUpdate) Actual implementation of value reading+binding operation.protected Object_bindAndClose(DeserializationContextExt ctxt, JsonParser p0) protected final JsonNodeprotected <T> MappingIterator<T>protected final JsonNodeprotected final JsonNodeSame as_bindAsTree(tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.core.JsonParser)except end-of-input is reported by returningnull, not "missing node"protected JsonParser_considerFilter(JsonParser p, boolean multiValue) Consider filter when creating JsonParser.protected DeserializationContextExtInternal helper method called to create an instance ofDeserializationContextfor deserializing a single root value.protected DeserializationContextExtprotected ValueDeserializer<Object>Method called to locate deserializer for the passed root-level value.protected ValueDeserializer<Object>protected voidAlternative to_initForReading(tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.core.JsonParser)used in cases where reading of multiple values means that we may or may not want to advance the stream, but need to do other initialization.protected JsonTokenprotected InputStream_inputStream(File f) protected InputStream_inputStream(Path path) protected ObjectReader_new(ObjectReader base, DeserializationConfig config) Factory method called by various "withXxx()" methodsprotected ObjectReader_new(ObjectReader base, DeserializationConfig config, JavaType valueType, ValueDeserializer<Object> rootDeser, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Factory method called by various "withXxx()" methodsprotected <T> MappingIterator<T>_newIterator(JsonParser p, DeserializationContext ctxt, ValueDeserializer<?> deser, boolean parserManaged) Factory method used to createMappingIteratorinstances; either default, or custom subtype.protected ValueDeserializer<Object>_prefetchRootDeserializer(JavaType valueType) Method called to locate deserializer ahead of time, if permitted by configuration.protected final void_verifyNoTrailingTokens(JsonParser p, DeserializationContext ctxt, JavaType bindType) protected void_verifySchemaType(FormatSchema schema) protected final ObjectReader_with(DeserializationConfig newConfig) Convenience method to bind fromJsonPointer.at(JsonPointer pointer) Convenience method to bind fromJsonPointerJsonPointerBasedFilteris registered and will be used for parsing later.booleanNode(boolean b) Factory method for constructing non-blockingJsonParserthat is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs aObjectReadContextand then callsTokenStreamFactory.createNonBlockingByteArrayParser(ObjectReadContext).Factory method for constructing non-blockingJsonParserthat is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs aObjectReadContextand then callsTokenStreamFactory.createNonBlockingByteBufferParser(ObjectReadContext).createParser(byte[] content) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,byte[]).createParser(byte[] content, int offset, int len) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,byte[],int,int).createParser(char[] content) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,char[]).createParser(char[] content, int offset, int len) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,char[],int,int).createParser(DataInput content) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,DataInput).createParser(File src) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,java.io.File).createParser(InputStream src) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,InputStream).createParser(Reader src) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,Reader).createParser(String content) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,String).createParser(Path src) Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,Path).Method for constructing a new reader instance that is configured to data bind into specified type.forType(TypeReference<?> valueTypeRef) Method for constructing a new reader instance that is configured to data bind into specified type.Method for constructing a new reader instance that is configured to data bind into specified type.Deprecated.booleanbooleanbooleanbooleannullNode()readTree(byte[] content) Same asreadTree(InputStream)except content read from passed-in byte array.readTree(byte[] content, int offset, int len) Same asreadTree(InputStream)except content read from passed-in byte array.Same asreadTree(InputStream)except content read using passed-inDataInput.readTree(InputStream src) Method that reads content from given input source, using configuration of this reader, and binds it as JSON Tree.Same asreadTree(InputStream)except content accessed through passed-inReaderSame asreadTree(InputStream)except content read from passed-inStringConvenience method that binds content read using given parser, using configuration of this reader, except that content is bound as JSON tree instead of configured root value type.readTree(TokenBuffer src) Same asreadTree(InputStream)except content read using passed-inTokenBuffer.<T> TreadValue(byte[] content) Method that binds content read from given byte array, using configuration of this reader.<T> TreadValue(byte[] buffer, int offset, int length) Method that binds content read from given byte array, using configuration of this reader.<T> T<T> TMethod that binds content read from givenFileusing configuration of this reader.<T> TreadValue(InputStream in) Method that binds content read from given input source, using configuration of this reader.<T> TMethod that binds content read from given input source, using configuration of this reader.<T> TMethod that binds content read from given JSON string, using configuration of this reader.<T> TMethod that binds content read from givenPathusing configuration of this reader.<T> TMethod that binds content read using given parser, using configuration of this reader, including expected result type.<T> TConvenience method for converting results from given JSON tree into given value type.<T> TreadValue(TokenBuffer src) Method that binds content read from givenTokenBufferusing configuration of this reader.final <T> MappingIterator<T>readValues(byte[] content) Overloaded version ofreadValue(InputStream).<T> MappingIterator<T>readValues(byte[] content, int offset, int length) Overloaded version ofreadValue(InputStream).<T> MappingIterator<T>readValues(DataInput src) <T> MappingIterator<T>readValues(File src) Overloaded version ofreadValue(InputStream).<T> MappingIterator<T>readValues(InputStream src) Method for reading sequence of Objects from parser stream.<T> MappingIterator<T>readValues(Reader src) Overloaded version ofreadValue(InputStream).<T> MappingIterator<T>readValues(String content) Overloaded version ofreadValue(InputStream).<T> MappingIterator<T>readValues(Path src) Overloaded version ofreadValues(InputStream).<T> MappingIterator<T>Method for reading sequence of Objects from parser stream.<T> Iterator<T>readValues(JsonParser p, Class<T> valueType) Convenience method that is equivalent to:<T> Iterator<T>readValues(JsonParser p, ResolvedType valueType) Convenience method that is equivalent to:<T> Iterator<T>readValues(JsonParser p, TypeReference<T> valueTypeRef) Convenience method that is equivalent to:<T> Iterator<T>readValues(JsonParser p, JavaType valueType) Convenience method that is equivalent to:<T> MappingIterator<T>readValues(TokenBuffer src) stringNode(String text) protected JsonParsertreeAsTokens(JsonNode n, DeserializationContext ctxt) <T> TtreeToValue(TreeNode n, Class<T> valueType) <T> TtreeToValue(TreeNode n, JavaType valueType) Same astreeToValue(TreeNode, Class)but with type-resolved target value type.version()Method that will return version information stored in and read from jar that contains this class.with(Base64Variant defaultBase64) with(FormatFeature feature) Method for constructing a new reader instance that is configured with specified feature enabled.with(FormatSchema schema) Method for constructing a new instance with configuration that passes specifiedFormatSchematoJsonParserthat is constructed for parsing content.with(StreamReadFeature feature) Method for constructing a new reader instance that is configured with specified feature enabled.with(ContextAttributes attrs) Mutant factory for overriding set of (default) attributes forObjectReaderto use.with(DatatypeFeature feature) Method for constructing a new reader instance that is configured with specified feature enabled.with(DeserializationConfig config) Mutant factory method that will construct a new instance that has specified underlyingDeserializationConfig.with(DeserializationFeature feature) Method for constructing a new reader instance that is configured with specified feature enabled.with(DeserializationFeature first, DeserializationFeature... other) Method for constructing a new reader instance that is configured with specified features enabled.with(InjectableValues injectableValues) Method for constructing a new instance with configuration that uses passedInjectableValuesto provide injectable values.Method for constructing a new reader instance with configuration that uses passedJsonNodeFactoryfor constructingJsonNodeinstances.withAttribute(Object key, Object value) withAttributes(Map<?, ?> attrs) withFeatures(FormatFeature... features) Method for constructing a new reader instance that is configured with specified features enabled.withFeatures(StreamReadFeature... features) Method for constructing a new reader instance that is configured with specified features enabled.withFeatures(DatatypeFeature... features) Method for constructing a new reader instance that is configured with specified features enabled.withFeatures(DeserializationFeature... features) Method for constructing a new reader instance that is configured with specified features enabled.without(FormatFeature feature) Method for constructing a new reader instance that is configured with specified feature disabled.without(StreamReadFeature feature) Method for constructing a new reader instance that is configured with specified feature disabled.without(DatatypeFeature feature) Method for constructing a new reader instance that is configured with specified feature disabled.without(DeserializationFeature feature) Method for constructing a new reader instance that is configured with specified feature disabled.without(DeserializationFeature first, DeserializationFeature... other) Method for constructing a new reader instance that is configured with specified features disabled.withoutAttribute(Object key) withoutFeatures(FormatFeature... features) Method for constructing a new reader instance that is configured with specified features disabled.withoutFeatures(StreamReadFeature... features) Method for constructing a new reader instance that is configured with specified features disabled.withoutFeatures(DatatypeFeature... features) Method for constructing a new reader instance that is configured with specified features disabled.withoutFeatures(DeserializationFeature... features) Method for constructing a new reader instance that is configured with specified features disabled.Convenience method that is same as calling:withRootName("")which will forcibly prevent use of root name wrapping when writing values with thisObjectReader.withRootName(String rootName) Method for constructing a new instance with configuration that specifies what root name to expect for "root name unwrapping".withRootName(PropertyName rootName) withValueToUpdate(Object value) Method for constructing a new instance with configuration that updates passed Object (as root value), instead of constructing a new value.Method for constructing a new instance with configuration that uses specified View for filtering.voidwriteTree(JsonGenerator g, TreeNode tree)
-
Field Details
-
JSON_NODE_TYPE
-
_config
General serialization configuration settings; while immutable, can use copy-constructor to create modified instances as necessary. -
_contexts
Blueprint instance of deserialization context; used for creating actual instance when needed. -
_parserFactory
Factory used for constructingJsonParsers -
_unwrapRoot
protected final boolean _unwrapRootFlag that indicates whether root values are expected to be unwrapped or not -
_valueType
Declared type of value to instantiate during deserialization. Defines which deserializer to use; as well as base type of instance to construct if an updatable value is not configured to be used (subject to changes by embedded type information, for polymorphic types). If_valueToUpdateis non-null, only used for locating deserializer. -
_rootDeserializer
We may pre-fetch deserializer as soon as_valueTypeis known, and if so, reuse it afterwards. This allows avoiding further deserializer lookups and increases performance a bit on cases where readers are reused. -
_valueToUpdate
Instance to update with data binding; if any. If null, a new instance is created, if non-null, properties of this value object will be updated instead. Note that value can be of almost any type, except notArrayType; array types cannot be modified because array size is immutable. -
_schema
When using data format that uses a schema, schema is passed to parser. -
_injectableValues
Values that can be injected during deserialization, if any. -
_rootDeserializers
Root-level cached deserializers. Passed byObjectMapper, shared with it.
-
-
Constructor Details
-
ObjectReader
Constructor used byObjectMapperfor initial instantiation -
ObjectReader
protected ObjectReader(ObjectMapper mapper, DeserializationConfig config, JavaType valueType, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Constructor called when a root deserializer should be fetched based on other configuration. -
ObjectReader
protected ObjectReader(ObjectReader base, DeserializationConfig config, JavaType valueType, ValueDeserializer<Object> rootDeser, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Copy constructor used for building variations. -
ObjectReader
Copy constructor used when modifying simple feature flags -
ObjectReader
-
-
Method Details
-
version
Method that will return version information stored in and read from jar that contains this class. -
_new
Factory method called by various "withXxx()" methods -
_new
protected ObjectReader _new(ObjectReader base, DeserializationConfig config, JavaType valueType, ValueDeserializer<Object> rootDeser, Object valueToUpdate, FormatSchema schema, InjectableValues injectableValues) Factory method called by various "withXxx()" methods -
_newIterator
protected <T> MappingIterator<T> _newIterator(JsonParser p, DeserializationContext ctxt, ValueDeserializer<?> deser, boolean parserManaged) Factory method used to createMappingIteratorinstances; either default, or custom subtype. -
_initForReading
-
_initForMultiRead
Alternative to_initForReading(tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.core.JsonParser)used in cases where reading of multiple values means that we may or may not want to advance the stream, but need to do other initialization.Base implementation only sets configured
FormatSchema, if any, on parser. -
with
Method for constructing a new reader instance that is configured with specified feature enabled. -
with
Method for constructing a new reader instance that is configured with specified features enabled. -
withFeatures
Method for constructing a new reader instance that is configured with specified features enabled. -
without
Method for constructing a new reader instance that is configured with specified feature disabled. -
without
Method for constructing a new reader instance that is configured with specified features disabled. -
withoutFeatures
Method for constructing a new reader instance that is configured with specified features disabled. -
with
Method for constructing a new reader instance that is configured with specified feature enabled. -
withFeatures
Method for constructing a new reader instance that is configured with specified features enabled. -
without
Method for constructing a new reader instance that is configured with specified feature disabled. -
withoutFeatures
Method for constructing a new reader instance that is configured with specified features disabled. -
with
Method for constructing a new reader instance that is configured with specified feature enabled. -
withFeatures
Method for constructing a new reader instance that is configured with specified features enabled. -
without
Method for constructing a new reader instance that is configured with specified feature disabled. -
withoutFeatures
Method for constructing a new reader instance that is configured with specified features disabled. -
with
Method for constructing a new reader instance that is configured with specified feature enabled. -
withFeatures
Method for constructing a new reader instance that is configured with specified features enabled. -
without
Method for constructing a new reader instance that is configured with specified feature disabled. -
withoutFeatures
Method for constructing a new reader instance that is configured with specified features disabled. -
at
Convenience method to bind fromJsonPointer.JsonPointerBasedFilteris registered and will be used for parsing later. -
at
Convenience method to bind fromJsonPointerJsonPointerBasedFilteris registered and will be used for parsing later. -
with
Mutant factory method that will construct a new instance that has specified underlyingDeserializationConfig.NOTE: use of this method is not recommended, as there are many other re-configuration methods available.
-
with
Method for constructing a new instance with configuration that uses passedInjectableValuesto provide injectable values.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
with
Method for constructing a new reader instance with configuration that uses passedJsonNodeFactoryfor constructingJsonNodeinstances.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
withRootName
Method for constructing a new instance with configuration that specifies what root name to expect for "root name unwrapping". SeeMapperConfigBase.withRootName(String)for details.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
withRootName
-
withoutRootName
Convenience method that is same as calling:withRootName("")which will forcibly prevent use of root name wrapping when writing values with thisObjectReader. -
with
Method for constructing a new instance with configuration that passes specifiedFormatSchematoJsonParserthat is constructed for parsing content.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
forType
Method for constructing a new reader instance that is configured to data bind into specified type.Note that the method does not change state of this reader, but rather construct and returns a newly configured instance.
-
forType
Method for constructing a new reader instance that is configured to data bind into specified type.Note that the method does not change state of this reader, but rather construct and returns a newly configured instance.
-
forType
Method for constructing a new reader instance that is configured to data bind into specified type.Note that the method does not change state of this reader, but rather construct and returns a newly configured instance.
-
withValueToUpdate
Method for constructing a new instance with configuration that updates passed Object (as root value), instead of constructing a new value.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
withView
Method for constructing a new instance with configuration that uses specified View for filtering.Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.
-
with
-
with
-
withHandler
-
with
-
with
Mutant factory for overriding set of (default) attributes forObjectReaderto use.Note that this will replace defaults passed by
ObjectMapper.- Parameters:
attrs- DefaultContextAttributesto use with a reader- Returns:
ObjectReaderinstance with specified default attributes (which is usually a newly constructed reader instance with otherwise identical settings)
-
withAttributes
-
withAttribute
-
withoutAttribute
-
_with
-
isEnabled
-
isEnabled
-
isEnabled
-
isEnabled
-
getConfig
-
parserFactory
- Since:
- 3.0
-
typeFactory
- Since:
- 3.0
-
getAttributes
-
getInjectableValues
-
getValueType
-
getTypeFactory
Deprecated.Since 3.0 usetypeFactory() -
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,java.io.File).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,Path).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,InputStream).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,Reader).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,byte[]).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,byte[],int,int).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,String).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,char[]).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,char[],int,int).- Throws:
JacksonException- Since:
- 3.0
-
createParser
Factory method for constructingJsonParserthat is properly wired to allow callbacks for deserialization: basically constructs aObjectReadContextand then callsTokenStreamFactory.createParser(ObjectReadContext,DataInput).- Throws:
JacksonException- Since:
- 3.0
-
createNonBlockingByteArrayParser
Factory method for constructing non-blockingJsonParserthat is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs aObjectReadContextand then callsTokenStreamFactory.createNonBlockingByteArrayParser(ObjectReadContext).- Throws:
JacksonException- Since:
- 3.0
-
createNonBlockingByteBufferParser
Factory method for constructing non-blockingJsonParserthat is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs aObjectReadContextand then callsTokenStreamFactory.createNonBlockingByteBufferParser(ObjectReadContext).- Throws:
JacksonException- Since:
- 3.0
-
createObjectNode
- Specified by:
createObjectNodein interfaceTreeCodec
-
createArrayNode
- Specified by:
createArrayNodein interfaceTreeCodec
-
booleanNode
- Specified by:
booleanNodein interfaceTreeCodec
-
stringNode
- Specified by:
stringNodein interfaceTreeCodec
-
missingNode
- Specified by:
missingNodein interfaceTreeCodec
-
nullNode
-
treeAsTokens
- Specified by:
treeAsTokensin interfaceTreeCodec
-
treeAsTokens
-
readTree
Convenience method that binds content read using given parser, using configuration of this reader, except that content is bound as JSON tree instead of configured root value type. ReturnsJsonNodethat represents the root of the resulting tree, if there was content to read, ornullif no more content is accessible via passedJsonParser.NOTE! Behavior with end-of-input (no more content) differs between this
readTreemethod, and all other methods that take input source: latter will return "missing node", NOTnullNote: if an object was specified with
withValueToUpdate(java.lang.Object), it will be ignored.- Specified by:
readTreein interfaceTreeCodec- Throws:
JacksonException
-
writeTree
-
readValue
Method that binds content read using given parser, using configuration of this reader, including expected result type. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Throws:
JacksonException
-
readValues
Convenience method that is equivalent to:withType(valueType).readValues(p);
Method reads a sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case
JsonParserMUST point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surroundingSTART_ARRAY(one that contains values to read) but rather to the token following it which is the first token of the first value to read.- Throws:
JacksonException
-
readValues
public <T> Iterator<T> readValues(JsonParser p, TypeReference<T> valueTypeRef) throws JacksonException Convenience method that is equivalent to:withType(valueTypeRef).readValues(p);
Method reads a sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case
JsonParserMUST point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surroundingSTART_ARRAY(one that contains values to read) but rather to the token following it which is the first token of the first value to read.- Throws:
JacksonException
-
readValues
Convenience method that is equivalent to:withType(valueType).readValues(p);
Method reads a sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case
JsonParserMUST point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surroundingSTART_ARRAY(one that contains values to read) but rather to the token following it which is the first token of the first value to read.- Throws:
JacksonException
-
readValues
Convenience method that is equivalent to:withType(valueType).readValues(p);
Method reads a sequence of Objects from parser stream. Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case
JsonParserMUST point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surroundingSTART_ARRAY(one that contains values to read) but rather to the token following it which is the first token of the first value to read.- Throws:
JacksonException
-
readValue
Method that binds content read from given input source, using configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Throws:
JacksonException
-
readValue
Method that binds content read from given input source, using configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
r- Source to read content from- Throws:
JacksonException
-
readValue
Method that binds content read from given JSON string, using configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
content- String that contains content to read- Throws:
JacksonException
-
readValue
Method that binds content read from given byte array, using configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
content- Byte array that contains encoded content to read- Throws:
JacksonException
-
readValue
Method that binds content read from given byte array, using configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
buffer- Byte array that contains encoded content to readoffset- Offset of the first content byte inbufferlength- Length of content inbuffer, in bytes- Throws:
JacksonException
-
readValue
Method that binds content read from givenFileusing configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
f- File that contains content to read- Throws:
JacksonException
-
readValue
Method that binds content read from givenPathusing configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
path- Path that contains content to read- Throws:
JacksonException
-
readValue
Convenience method for converting results from given JSON tree into given value type. Basically short-cut for:objectReader.readValue(src.traverse())
- Parameters:
node- Tree that contains content to convert- Throws:
JacksonException
-
readValue
- Throws:
JacksonException
-
readValue
Method that binds content read from givenTokenBufferusing configuration of this reader. Value return is either newly constructed, or root value that was specified withwithValueToUpdate(Object).- Parameters:
src-TokenBufferthat contains content to read- Throws:
JacksonException
-
readTree
Method that reads content from given input source, using configuration of this reader, and binds it as JSON Tree. ReturnsJsonNodethat represents the root of the resulting tree, if there was content to read, or "missing node" (instance ofJsonNodefor whichJsonNode.isMissingNode()returns true, and behaves otherwise similar to "null node") if no more content is accessible through passed-in input source.NOTE! Behavior with end-of-input (no more content) differs between this
readTreemethod, andreadTree(JsonParser)-- latter returnsnullfor "no content" case.Note that if an object was specified with a call to
withValueToUpdate(Object)it will just be ignored; result is always a newly constructedJsonNodeinstance.- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content accessed through passed-inReader- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content read from passed-inString- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content read from passed-in byte array.- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content read from passed-in byte array.- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content read using passed-inDataInput.- Throws:
JacksonException
-
readTree
Same asreadTree(InputStream)except content read using passed-inTokenBuffer.- Throws:
JacksonException
-
readValues
Method for reading sequence of Objects from parser stream.Sequence can be either root-level "unwrapped" sequence (without surrounding JSON array), or a sequence contained in a JSON Array. In either case
JsonParsermust point to the first token of the first element, OR not point to any token (in which case it is advanced to the next token). This means, specifically, that for wrapped sequences, parser MUST NOT point to the surroundingSTART_ARRAYbut rather to the token following it.- Throws:
JacksonException
-
readValues
Method for reading sequence of Objects from parser stream.Sequence can be either wrapped or unwrapped root-level sequence: wrapped means that the elements are enclosed in JSON Array; and unwrapped that elements are directly accessed at main level. Assumption is that iff the first token of the document is
START_ARRAY, we have a wrapped sequence; otherwise unwrapped. For wrapped sequences, leadingSTART_ARRAYis skipped, so that for both cases, underlyingJsonParserwill point to what is expected to be the first token of the first element.Note that the wrapped vs unwrapped logic means that it is NOT possible to use this method for reading an unwrapped sequence of elements written as JSON Arrays: to read such sequences, one has to use
readValues(JsonParser), making sure parser points to the first token of the first element (i.e. the secondSTART_ARRAYwhich is part of the first element).- Throws:
JacksonException
-
readValues
Overloaded version ofreadValue(InputStream).- Throws:
JacksonException
-
readValues
Overloaded version ofreadValue(InputStream).- Parameters:
content- String that contains JSON content to parse- Throws:
JacksonException
-
readValues
public <T> MappingIterator<T> readValues(byte[] content, int offset, int length) throws JacksonException Overloaded version ofreadValue(InputStream).- Throws:
JacksonException
-
readValues
Overloaded version ofreadValue(InputStream).- Throws:
JacksonException
-
readValues
Overloaded version ofreadValue(InputStream).- Throws:
JacksonException
-
readValues
Overloaded version ofreadValues(InputStream).- Throws:
JacksonException- Since:
- 3.0
-
readValues
- Throws:
JacksonException
-
readValues
- Throws:
JacksonException
-
treeToValue
- Throws:
JacksonException
-
treeToValue
Same astreeToValue(TreeNode, Class)but with type-resolved target value type.- Throws:
JacksonException
-
_bind
protected Object _bind(DeserializationContextExt ctxt, JsonParser p, Object valueToUpdate) throws JacksonException Actual implementation of value reading+binding operation.- Throws:
JacksonException
-
_bindAndClose
protected Object _bindAndClose(DeserializationContextExt ctxt, JsonParser p0) throws JacksonException - Throws:
JacksonException
-
_bindAndCloseAsTree
protected final JsonNode _bindAndCloseAsTree(DeserializationContextExt ctxt, JsonParser p0) throws JacksonException - Throws:
JacksonException
-
_bindAsTree
protected final JsonNode _bindAsTree(DeserializationContextExt ctxt, JsonParser p) throws JacksonException - Throws:
JacksonException
-
_bindAsTreeOrNull
protected final JsonNode _bindAsTreeOrNull(DeserializationContextExt ctxt, JsonParser p) throws JacksonException Same as_bindAsTree(tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.core.JsonParser)except end-of-input is reported by returningnull, not "missing node"- Throws:
JacksonException
-
_bindAndReadValues
protected <T> MappingIterator<T> _bindAndReadValues(DeserializationContextExt ctxt, JsonParser p) throws JacksonException - Throws:
JacksonException
-
_considerFilter
Consider filter when creating JsonParser. -
_verifyNoTrailingTokens
protected final void _verifyNoTrailingTokens(JsonParser p, DeserializationContext ctxt, JavaType bindType) throws JacksonException - Throws:
JacksonException
-
_verifySchemaType
-
_deserializationContext
Internal helper method called to create an instance ofDeserializationContextfor deserializing a single root value. Can be overridden if a custom context is needed. -
_deserializationContext
-
_inputStream
- Throws:
JacksonException
-
_inputStream
- Throws:
JacksonException
-
_assertNotNull
-
_findRootDeserializer
protected ValueDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt) throws DatabindException Method called to locate deserializer for the passed root-level value.- Throws:
DatabindException
-
_findTreeDeserializer
protected ValueDeserializer<Object> _findTreeDeserializer(DeserializationContext ctxt) throws DatabindException - Throws:
DatabindException
-
_prefetchRootDeserializer
Method called to locate deserializer ahead of time, if permitted by configuration. Method also is NOT to throw an exception if access fails.
-
typeFactory()