com.fasterxml.jackson.databind

Class ObjectReader

  • All Implemented Interfaces:
    Versioned, Serializable


    public class ObjectReader
    extends ObjectCodec
    implements Versioned, Serializable
    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 (with Jackson 2.8 and above) by users. It is left as non-final mostly to allow frameworks that require bytecode generation for proxying and similar use cases, but there is no expecation that functionality should be extended by sub-classing.

    See Also:
    Serialized Form
    • Field Detail

      • _config

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

        protected final DefaultDeserializationContext _context
        Blueprint instance of deserialization context; used for creating actual instance when needed.
      • _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 JsonDeserializer<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.
        Since:
        2.1
      • _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 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.
      • _dataFormatReaders

        protected final DataFormatReaders _dataFormatReaders
        Optional detector used for auto-detecting data format that byte-based input uses.

        NOTE: If defined non-null, readValue() methods that take Reader or String input will fail with exception, because format-detection only works on byte-sources. Also, if format cannot be detect reliably (as per detector settings), a JsonParseException will be thrown).

        Since:
        2.1

Copyright © 2008–2019 FasterXML. All rights reserved.