Class BeanDeserializer

All Implemented Interfaces:
NullValueProvider, ValueInstantiator.Gettable
Direct Known Subclasses:
ThrowableDeserializer

public class BeanDeserializer extends BeanDeserializerBase
Deserializer class that can deserialize instances of arbitrary bean objects, usually from JSON Object structs,
  • Field Details

    • _propNameMatcher

      protected tools.jackson.core.sym.PropertyNameMatcher _propNameMatcher
    • _propsByIndex

      protected SettableBeanProperty[] _propsByIndex
    • _currentlyTransforming

      protected transient volatile NameTransformer _currentlyTransforming
      State marker we need in order to avoid infinite recursion for some cases (not very clean, alas, but has to do for now)
  • Constructor Details

  • Method Details

    • unwrappingDeserializer

      public ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext ctxt, NameTransformer transformer)
      Description copied from class: ValueDeserializer
      Method that will return deserializer instance that is able to handle "unwrapped" value instances If no unwrapped instance can be constructed, will simply return this object as-is.

      Default implementation just returns 'this' indicating that no unwrapped variant exists

      Specified by:
      unwrappingDeserializer in class BeanDeserializerBase
    • withObjectIdReader

      public BeanDeserializer withObjectIdReader(ObjectIdReader oir)
      Specified by:
      withObjectIdReader in class BeanDeserializerBase
    • withByNameInclusion

      public BeanDeserializer withByNameInclusion(Set<String> ignorableProps, Set<String> includableProps)
      Specified by:
      withByNameInclusion in class BeanDeserializerBase
    • withIgnoreAllUnknown

      public BeanDeserializerBase withIgnoreAllUnknown(boolean ignoreUnknown)
      Specified by:
      withIgnoreAllUnknown in class BeanDeserializerBase
    • withBeanProperties

      public BeanDeserializerBase withBeanProperties(BeanPropertyMap props)
      Description copied from class: BeanDeserializerBase
      Mutant factory method that custom sub-classes must override; not left as abstract to prevent more drastic backwards compatibility problems.
      Overrides:
      withBeanProperties in class BeanDeserializerBase
    • asArrayDeserializer

      protected BeanDeserializerBase asArrayDeserializer()
      Description copied from class: BeanDeserializerBase
      Fluent factory for creating a variant that can handle POJO output as a JSON Array. Implementations may ignore this request if no such input is possible.
      Specified by:
      asArrayDeserializer in class BeanDeserializerBase
    • initNameMatcher

      protected void initNameMatcher(DeserializationContext ctxt)
      Specified by:
      initNameMatcher in class BeanDeserializerBase
    • deserialize

      public Object deserialize(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Main deserialization method for bean-based objects (POJOs).
      Specified by:
      deserialize in class ValueDeserializer<Object>
      Parameters:
      p - Parser used for reading JSON content
      ctxt - Context that can be used to access information about this deserialization activity.
      Returns:
      Deserialized value
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeOther

      protected final Object _deserializeOther(tools.jackson.core.JsonParser p, DeserializationContext ctxt, tools.jackson.core.JsonToken t) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserialize

      public Object deserialize(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean) throws tools.jackson.core.JacksonException
      Secondary deserialization method, called in cases where POJO instance is created as part of deserialization, potentially after collecting some or all of the properties to set.
      Overrides:
      deserialize in class ValueDeserializer<Object>
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeRecordForUpdate

      protected Object _deserializeRecordForUpdate(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object existingRecord) throws tools.jackson.core.JacksonException
      Helper method for handling "update" deserialization for Record types (which are immutable and require constructing a new instance).

      Pre-populates creator properties from the existing Record, then overrides with values from JSON input, and constructs a new Record instance.

      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.1
    • deserializeFromObject

      public Object deserializeFromObject(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      General version used when handling needs more advanced features.
      Specified by:
      deserializeFromObject in class BeanDeserializerBase
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeUsingPropertyBased

      protected Object _deserializeUsingPropertyBased(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Method called to deserialize bean using "property-based creator": this means that a non-default constructor or factory method is called, and then possibly other setters. The trick is that values for creator method need to be buffered, first; and due to non-guaranteed ordering possibly some other properties as well.
      Specified by:
      _deserializeUsingPropertyBased in class BeanDeserializerBase
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeWithErrorWrapping

      protected final Object _deserializeWithErrorWrapping(tools.jackson.core.JsonParser p, DeserializationContext ctxt, SettableBeanProperty prop) throws DatabindException
      Throws:
      DatabindException
    • deserializeFromNull

      protected Object deserializeFromNull(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Helper method called for rare case of pointing to JsonToken.VALUE_NULL token. While this is most often an erroneous condition, there is one specific case with XML handling where polymorphic type with no properties is exposed as such, and should be handled same as empty Object.
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeFromArray

      protected Object _deserializeFromArray(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Description copied from class: StdDeserializer
      Helper method that allows easy support for array-related coercion features: checks for either empty array, or single-value array-wrapped value (if coercion enabled by CoercionConfigs (since 2.12), and either reports an exception (if no coercion allowed), or returns appropriate result value using coercion mechanism indicated.

      This method should NOT be called if Array representation is explicitly supported for type: it should only be called in case it is otherwise unrecognized.

      NOTE: in case of unwrapped single element, will handle actual decoding by calling StdDeserializer._deserializeWrappedValue(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext), which by default calls ValueDeserializer.deserialize(JsonParser, DeserializationContext).

      Overrides:
      _deserializeFromArray in class StdDeserializer<Object>
      Throws:
      tools.jackson.core.JacksonException
    • deserializeWithView

      protected final Object deserializeWithView(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean, Class<?> activeView) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserializeWithUnwrapped

      protected Object deserializeWithUnwrapped(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Method called when there are declared "unwrapped" properties which need special handling
      Throws:
      tools.jackson.core.JacksonException
    • deserializeWithUnwrapped

      protected Object deserializeWithUnwrapped(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserializeUsingPropertyBasedWithUnwrapped

      protected Object deserializeUsingPropertyBasedWithUnwrapped(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserializeWithExternalTypeId

      protected Object deserializeWithExternalTypeId(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserializeWithExternalTypeId

      protected Object deserializeWithExternalTypeId(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeWithExternalTypeId

      protected Object _deserializeWithExternalTypeId(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean, ExternalTypeHandler ext) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • deserializeUsingPropertyBasedWithExternalTypeId

      protected Object deserializeUsingPropertyBasedWithExternalTypeId(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _handleNullFromPropsBasedCreator

      protected void _handleNullFromPropsBasedCreator(tools.jackson.core.JsonParser p, DeserializationContext ctxt, TokenBuffer unknown, List<tools.jackson.databind.deser.bean.BeanDeserializer.BeanReferring> referrings)
    • _handleUnexpectedWithin

      protected Object _handleUnexpectedWithin(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean) throws tools.jackson.core.JacksonException
      Method called if an unexpected token (other then JsonToken.PROPERTY_NAME) is found after POJO has been instantiated and partially bound.
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0