Class ObjectReader

java.lang.Object
tools.jackson.databind.ObjectReader
All Implemented Interfaces:
tools.jackson.core.TreeCodec, tools.jackson.core.Versioned

public class ObjectReader extends Object implements tools.jackson.core.Versioned, tools.jackson.core.TreeCodec
Builder object that can be used for per-serialization configuration of deserialization parameters, such as root type to use or object to update (instead of constructing new instance).

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 Details

    • JSON_NODE_TYPE

      protected static final JavaType JSON_NODE_TYPE
    • _config

      protected final DeserializationConfig _config
      General serialization configuration settings; while immutable, can use copy-constructor to create modified instances as necessary.
    • _contexts

      protected final DeserializationContexts _contexts
      Blueprint instance of deserialization context; used for creating actual instance when needed.
    • _parserFactory

      protected final tools.jackson.core.TokenStreamFactory _parserFactory
      Factory used for constructing JsonParsers
    • _unwrapRoot

      protected final boolean _unwrapRoot
      Flag that indicates whether root values are expected to be unwrapped or not
    • _valueType

      protected final JavaType _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 _valueToUpdate is non-null, only used for locating deserializer.
    • _rootDeserializer

      protected final ValueDeserializer<Object> _rootDeserializer
      We may pre-fetch deserializer as soon as _valueType is 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

      protected final Object _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 not ArrayType; array types cannot be modified because array size is immutable.
    • _schema

      protected final tools.jackson.core.FormatSchema _schema
      When using data format that uses a schema, schema is passed to parser.
    • _injectableValues

      protected final InjectableValues _injectableValues
      Values that can be injected during deserialization, if any.
    • _rootDeserializers

      protected final ConcurrentHashMap<JavaType,ValueDeserializer<Object>> _rootDeserializers
      Root-level cached deserializers. Passed by ObjectMapper, shared with it.
  • Constructor Details

  • Method Details

    • version

      public tools.jackson.core.Version version()
      Method that will return version information stored in and read from jar that contains this class.
      Specified by:
      version in interface tools.jackson.core.Versioned
    • _new

      protected ObjectReader _new(ObjectReader base, DeserializationConfig config)
      Factory method called by various "withXxx()" methods
    • _new

      protected ObjectReader _new(ObjectReader base, DeserializationConfig config, JavaType valueType, ValueDeserializer<Object> rootDeser, Object valueToUpdate, tools.jackson.core.FormatSchema schema, InjectableValues injectableValues)
      Factory method called by various "withXxx()" methods
    • _newIterator

      protected <T> MappingIterator<T> _newIterator(tools.jackson.core.JsonParser p, DeserializationContext ctxt, ValueDeserializer<?> deser, boolean parserManaged)
      Factory method used to create MappingIterator instances; either default, or custom subtype.
    • _initForReading

      protected tools.jackson.core.JsonToken _initForReading(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p)
    • _initForMultiRead

      protected void _initForMultiRead(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p)
      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

      public ObjectReader with(DeserializationFeature feature)
      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

      public ObjectReader withFeatures(DeserializationFeature... features)
      Method for constructing a new reader instance that is configured with specified features enabled.
    • without

      public ObjectReader without(DeserializationFeature feature)
      Method for constructing a new reader instance that is configured with specified feature disabled.
    • without

      public ObjectReader without(DeserializationFeature first, DeserializationFeature... other)
      Method for constructing a new reader instance that is configured with specified features disabled.
    • withoutFeatures

      public ObjectReader withoutFeatures(DeserializationFeature... features)
      Method for constructing a new reader instance that is configured with specified features disabled.
    • with

      public ObjectReader with(DatatypeFeature feature)
      Method for constructing a new reader instance that is configured with specified feature enabled.
    • withFeatures

      public ObjectReader withFeatures(DatatypeFeature... features)
      Method for constructing a new reader instance that is configured with specified features enabled.
    • without

      public ObjectReader without(DatatypeFeature feature)
      Method for constructing a new reader instance that is configured with specified feature disabled.
    • withoutFeatures

      public ObjectReader withoutFeatures(DatatypeFeature... features)
      Method for constructing a new reader instance that is configured with specified features disabled.
    • with

      public ObjectReader with(tools.jackson.core.StreamReadFeature feature)
      Method for constructing a new reader instance that is configured with specified feature enabled.
    • withFeatures

      public ObjectReader withFeatures(tools.jackson.core.StreamReadFeature... features)
      Method for constructing a new reader instance that is configured with specified features enabled.
    • without

      public ObjectReader without(tools.jackson.core.StreamReadFeature feature)
      Method for constructing a new reader instance that is configured with specified feature disabled.
    • withoutFeatures

      public ObjectReader withoutFeatures(tools.jackson.core.StreamReadFeature... features)
      Method for constructing a new reader instance that is configured with specified features disabled.
    • with

      public ObjectReader with(tools.jackson.core.FormatFeature feature)
      Method for constructing a new reader instance that is configured with specified feature enabled.
    • withFeatures

      public ObjectReader withFeatures(tools.jackson.core.FormatFeature... features)
      Method for constructing a new reader instance that is configured with specified features enabled.
    • without

      public ObjectReader without(tools.jackson.core.FormatFeature feature)
      Method for constructing a new reader instance that is configured with specified feature disabled.
    • withoutFeatures

      public ObjectReader withoutFeatures(tools.jackson.core.FormatFeature... features)
      Method for constructing a new reader instance that is configured with specified features disabled.
    • at

      public ObjectReader at(String pointerExpr)
      Convenience method to bind from JsonPointer. JsonPointerBasedFilter is registered and will be used for parsing later.
    • at

      public ObjectReader at(tools.jackson.core.JsonPointer pointer)
      Convenience method to bind from JsonPointer JsonPointerBasedFilter is registered and will be used for parsing later.
    • with

      public ObjectReader with(DeserializationConfig config)
      Mutant factory method that will construct a new instance that has specified underlying DeserializationConfig.

      NOTE: use of this method is not recommended, as there are many other re-configuration methods available.

    • with

      public ObjectReader with(InjectableValues injectableValues)
      Method for constructing a new instance with configuration that uses passed InjectableValues to provide injectable values.

      Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.

    • with

      public ObjectReader with(JsonNodeFactory f)
      Method for constructing a new reader instance with configuration that uses passed JsonNodeFactory for constructing JsonNode instances.

      Note that the method does NOT change state of this reader, but rather construct and returns a newly configured instance.

    • withRootName

      public ObjectReader withRootName(String rootName)
      Method for constructing a new instance with configuration that specifies what root name to expect for "root name unwrapping". See MapperConfigBase.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

      public ObjectReader withRootName(PropertyName rootName)
    • withoutRootName

      public ObjectReader withoutRootName()
      Convenience method that is same as calling: withRootName("") which will forcibly prevent use of root name wrapping when writing values with this ObjectReader.
    • with

      public ObjectReader with(tools.jackson.core.FormatSchema schema)
      Method for constructing a new instance with configuration that passes specified FormatSchema to JsonParser that 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

      public ObjectReader forType(JavaType valueType)
      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

      public ObjectReader forType(Class<?> valueType)
      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

      public ObjectReader forType(tools.jackson.core.type.TypeReference<?> valueTypeRef)
      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

      public ObjectReader withValueToUpdate(Object value)
      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

      public ObjectReader withView(Class<?> activeView)
      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

      public ObjectReader with(Locale l)
    • with

      public ObjectReader with(TimeZone tz)
    • withHandler

    • with

      public ObjectReader with(tools.jackson.core.Base64Variant defaultBase64)
    • with

      public ObjectReader with(ContextAttributes attrs)
      Mutant factory for overriding set of (default) attributes for ObjectReader to use.

      Note that this will replace defaults passed by ObjectMapper.

      Parameters:
      attrs - Default ContextAttributes to use with a reader
      Returns:
      ObjectReader instance with specified default attributes (which is usually a newly constructed reader instance with otherwise identical settings)
    • withAttributes

      public ObjectReader withAttributes(Map<?,?> attrs)
    • withAttribute

      public ObjectReader withAttribute(Object key, Object value)
    • withoutAttribute

      public ObjectReader withoutAttribute(Object key)
    • _with

      protected final ObjectReader _with(DeserializationConfig newConfig)
    • isEnabled

      public boolean isEnabled(DeserializationFeature f)
    • isEnabled

      public boolean isEnabled(MapperFeature f)
    • isEnabled

      public boolean isEnabled(DatatypeFeature f)
    • isEnabled

      public boolean isEnabled(tools.jackson.core.StreamReadFeature f)
    • getConfig

      public DeserializationConfig getConfig()
    • parserFactory

      public tools.jackson.core.TokenStreamFactory parserFactory()
      Since:
      3.0
    • typeFactory

      public TypeFactory typeFactory()
      Since:
      3.0
    • getAttributes

      public ContextAttributes getAttributes()
    • getInjectableValues

      public InjectableValues getInjectableValues()
    • getValueType

      public JavaType getValueType()
    • getTypeFactory

      @Deprecated public TypeFactory getTypeFactory()
      Deprecated.
      Since 3.0 use typeFactory()
    • createParser

      public tools.jackson.core.JsonParser createParser(File src) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,java.io.File).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(Path src) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,Path).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(URL src) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,java.net.URL).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(InputStream src) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,InputStream).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(Reader src) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,Reader).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(byte[] content) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,byte[]).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(byte[] content, int offset, int len) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,byte[],int,int).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(String content) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,String).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(char[] content) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,char[]).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(char[] content, int offset, int len) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,char[],int,int).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createParser

      public tools.jackson.core.JsonParser createParser(DataInput content) throws tools.jackson.core.JacksonException
      Factory method for constructing JsonParser that is properly wired to allow callbacks for deserialization: basically constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,DataInput).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createNonBlockingByteArrayParser

      public tools.jackson.core.JsonParser createNonBlockingByteArrayParser() throws tools.jackson.core.JacksonException
      Factory method for constructing non-blocking JsonParser that is properly wired to allow configuration access (and, if relevant for parser, callbacks): essentially constructs a ObjectReadContext and then calls TokenStreamFactory.createParser(ObjectReadContext,DataInput).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • createObjectNode

      public ObjectNode createObjectNode()
      Specified by:
      createObjectNode in interface tools.jackson.core.TreeCodec
    • createArrayNode

      public ArrayNode createArrayNode()
      Specified by:
      createArrayNode in interface tools.jackson.core.TreeCodec
    • booleanNode

      public JsonNode booleanNode(boolean b)
      Specified by:
      booleanNode in interface tools.jackson.core.TreeCodec
    • stringNode

      public JsonNode stringNode(String text)
      Specified by:
      stringNode in interface tools.jackson.core.TreeCodec
    • missingNode

      public JsonNode missingNode()
      Specified by:
      missingNode in interface tools.jackson.core.TreeCodec
    • nullNode

      public JsonNode nullNode()
      Specified by:
      nullNode in interface tools.jackson.core.TreeCodec
    • treeAsTokens

      public tools.jackson.core.JsonParser treeAsTokens(tools.jackson.core.TreeNode n)
      Specified by:
      treeAsTokens in interface tools.jackson.core.TreeCodec
    • treeAsTokens

      protected tools.jackson.core.JsonParser treeAsTokens(JsonNode n, DeserializationContext ctxt)
    • readTree

      public JsonNode readTree(tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      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. Returns JsonNode that represents the root of the resulting tree, if there was content to read, or null if no more content is accessible via passed JsonParser.

      NOTE! Behavior with end-of-input (no more content) differs between this readTree method, and all other methods that take input source: latter will return "missing node", NOT null

      Note: if an object was specified with withValueToUpdate(java.lang.Object), it will be ignored.

      Specified by:
      readTree in interface tools.jackson.core.TreeCodec
      Throws:
      tools.jackson.core.JacksonException
    • writeTree

      public void writeTree(tools.jackson.core.JsonGenerator g, tools.jackson.core.TreeNode tree)
      Specified by:
      writeTree in interface tools.jackson.core.TreeCodec
    • readValue

      public <T> T readValue(tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> Iterator<T> readValues(tools.jackson.core.JsonParser p, Class<T> valueType) throws tools.jackson.core.JacksonException
      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 JsonParser MUST 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 surrounding START_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:
      tools.jackson.core.JacksonException
    • readValues

      public <T> Iterator<T> readValues(tools.jackson.core.JsonParser p, tools.jackson.core.type.TypeReference<T> valueTypeRef) throws tools.jackson.core.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 JsonParser MUST 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 surrounding START_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:
      tools.jackson.core.JacksonException
    • readValues

      public <T> Iterator<T> readValues(tools.jackson.core.JsonParser p, tools.jackson.core.type.ResolvedType valueType) throws tools.jackson.core.JacksonException
      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 JsonParser MUST 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 surrounding START_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:
      tools.jackson.core.JacksonException
    • readValues

      public <T> Iterator<T> readValues(tools.jackson.core.JsonParser p, JavaType valueType) throws tools.jackson.core.JacksonException
      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 JsonParser MUST 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 surrounding START_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:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(InputStream in) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(Reader r) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Parameters:
      r - Source to read content from
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(String content) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Parameters:
      content - String that contains content to read
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(byte[] content) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Parameters:
      content - Byte array that contains encoded content to read
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(byte[] buffer, int offset, int length) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).
      Parameters:
      buffer - Byte array that contains encoded content to read
      offset - Offset of the first content byte in buffer
      length - Length of content in buffer, in bytes
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(File f) throws tools.jackson.core.JacksonException
      Method that binds content read from given File using configuration of this reader. Value return is either newly constructed, or root value that was specified with withValueToUpdate(Object).
      Parameters:
      f - File that contains content to read
      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(Path path) throws tools.jackson.core.JacksonException
      Method that binds content read from given Path using configuration of this reader. Value return is either newly constructed, or root value that was specified with withValueToUpdate(Object).
      Parameters:
      path - Path that contains content to read
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • readValue

      public <T> T readValue(URL url) throws tools.jackson.core.JacksonException
      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 with withValueToUpdate(Object).

      NOTE: handling of URL is delegated to TokenStreamFactory.createParser(ObjectReadContext, java.net.URL) and usually simply calls URL.openStream(), meaning no special handling is done. If different HTTP connection options are needed you will need to create InputStream separately.

      Throws:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(JsonNode node) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • readValue

      public <T> T readValue(DataInput input) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(InputStream src) throws tools.jackson.core.JacksonException
      Method that reads content from given input source, using configuration of this reader, and binds it as JSON Tree. Returns JsonNode that represents the root of the resulting tree, if there was content to read, or "missing node" (instance of JsonNode for which JsonNode.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 readTree method, and readTree(JsonParser) -- latter returns null for "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 constructed JsonNode instance.

      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(Reader src) throws tools.jackson.core.JacksonException
      Same as readTree(InputStream) except content accessed through passed-in Reader
      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(String content) throws tools.jackson.core.JacksonException
      Same as readTree(InputStream) except content read from passed-in String
      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(byte[] content) throws tools.jackson.core.JacksonException
      Same as readTree(InputStream) except content read from passed-in byte array.
      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(byte[] content, int offset, int len) throws tools.jackson.core.JacksonException
      Same as readTree(InputStream) except content read from passed-in byte array.
      Throws:
      tools.jackson.core.JacksonException
    • readTree

      public JsonNode readTree(DataInput content) throws tools.jackson.core.JacksonException
      Same as readTree(InputStream) except content read using passed-in DataInput.
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      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 JsonParser must 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 surrounding START_ARRAY but rather to the token following it.

      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(InputStream src) throws tools.jackson.core.JacksonException
      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, leading START_ARRAY is skipped, so that for both cases, underlying JsonParser will 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 second START_ARRAY which is part of the first element).

      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(Reader src) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(String content) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).
      Parameters:
      content - String that contains JSON content to parse
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(byte[] content, int offset, int length) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public final <T> MappingIterator<T> readValues(byte[] content) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(File src) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(Path src) throws tools.jackson.core.JacksonException
      Overloaded version of readValues(InputStream).
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0
    • readValues

      public <T> MappingIterator<T> readValues(URL src) throws tools.jackson.core.JacksonException
      Overloaded version of readValue(InputStream).

      NOTE: handling of URL is delegated to TokenStreamFactory.createParser(ObjectReadContext, java.net.URL) and usually simply calls URL.openStream(), meaning no special handling is done. If different HTTP connection options are needed you will need to create InputStream separately.

      Parameters:
      src - URL to read to access JSON content to parse.
      Throws:
      tools.jackson.core.JacksonException
    • readValues

      public <T> MappingIterator<T> readValues(DataInput src) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • treeToValue

      public <T> T treeToValue(tools.jackson.core.TreeNode n, Class<T> valueType) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • treeToValue

      public <T> T treeToValue(tools.jackson.core.TreeNode n, JavaType valueType) throws tools.jackson.core.JacksonException
      Same as treeToValue(TreeNode, Class) but with type-resolved target value type.
      Throws:
      tools.jackson.core.JacksonException
    • _bind

      protected Object _bind(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p, Object valueToUpdate) throws tools.jackson.core.JacksonException
      Actual implementation of value reading+binding operation.
      Throws:
      tools.jackson.core.JacksonException
    • _bindAndClose

      protected Object _bindAndClose(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p0) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _bindAndCloseAsTree

      protected final JsonNode _bindAndCloseAsTree(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p0) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _bindAsTree

      protected final JsonNode _bindAsTree(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _bindAsTreeOrNull

      protected final JsonNode _bindAsTreeOrNull(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      Same as _bindAsTree(tools.jackson.databind.deser.DeserializationContextExt, tools.jackson.core.JsonParser) except end-of-input is reported by returning null, not "missing node"
      Throws:
      tools.jackson.core.JacksonException
    • _bindAndReadValues

      protected <T> MappingIterator<T> _bindAndReadValues(DeserializationContextExt ctxt, tools.jackson.core.JsonParser p) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _considerFilter

      protected tools.jackson.core.JsonParser _considerFilter(tools.jackson.core.JsonParser p, boolean multiValue)
      Consider filter when creating JsonParser.
    • _verifyNoTrailingTokens

      protected final void _verifyNoTrailingTokens(tools.jackson.core.JsonParser p, DeserializationContext ctxt, JavaType bindType) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _verifySchemaType

      protected void _verifySchemaType(tools.jackson.core.FormatSchema schema)
    • _deserializationContext

      protected DeserializationContextExt _deserializationContext()
      Internal helper method called to create an instance of DeserializationContext for deserializing a single root value. Can be overridden if a custom context is needed.
    • _deserializationContext

      protected DeserializationContextExt _deserializationContext(tools.jackson.core.JsonParser p)
    • _inputStream

      protected InputStream _inputStream(URL src) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _inputStream

      protected InputStream _inputStream(File f) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _inputStream

      protected InputStream _inputStream(Path path) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _assertNotNull

      protected final void _assertNotNull(String paramName, Object src)
    • _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

      protected ValueDeserializer<Object> _prefetchRootDeserializer(JavaType valueType)
      Method called to locate deserializer ahead of time, if permitted by configuration. Method also is NOT to throw an exception if access fails.