Class BeanDeserializerBase

    • Method Detail

      • unwrappingDeserializer

        public abstract JsonDeserializer<Object> unwrappingDeserializer​(NameTransformer unwrapper)
        Description copied from class: JsonDeserializer
        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

        unwrappingDeserializer in class JsonDeserializer<Object>
      • withIgnoreAllUnknown

        public abstract BeanDeserializerBase withIgnoreAllUnknown​(boolean ignoreUnknown)
      • withBeanProperties

        public BeanDeserializerBase withBeanProperties​(BeanPropertyMap props)
        Mutant factory method that custom sub-classes must override; not left as abstract to prevent more drastic backwards compatibility problems.
      • createContextual

        public JsonDeserializer<?> createContextual​(DeserializationContext ctxt,
                                                    BeanProperty property)
                                             throws JsonMappingException
        Although most of post-processing is done in resolve(), we only get access to referring property's annotations here; and this is needed to support per-property ObjectIds. We will also consider Shape transformations (read from Array) at this point, since it may come from either Class definition or property.
        Specified by:
        createContextual in interface ContextualDeserializer
        ctxt - Deserialization context to access configuration, additional deserializers that may be needed by this deserializer
        property - Method, field or constructor parameter that represents the property (and is used to assign deserialized value). Should be available; but there may be cases where caller cannot provide it and null is passed instead (in which case impls usually pass 'this' deserializer as is)
        Deserializer to use for deserializing values of specified property; may be this instance or a new instance.
      • isCachable

        public boolean isCachable()
        Description copied from class: JsonDeserializer
        Method called to see if deserializer instance is cachable and usable for other properties of same type (type for which instance was created).

        Note that cached instances are still resolved on per-property basis, if instance implements ResolvableDeserializer: cached instance is just as the base. This means that in most cases it is safe to cache instances; however, it only makes sense to cache instances if instantiation is expensive, or if instances are heavy-weight.

        Default implementation returns false, to indicate that no caching is done.

        isCachable in class JsonDeserializer<Object>
      • isCaseInsensitive

        public boolean isCaseInsensitive()
        Accessor for checking whether this deserializer is operating in case-insensitive manner.
        True if this deserializer should match property names without considering casing; false if case has to match exactly.
      • supportsUpdate

        public Boolean supportsUpdate​(DeserializationConfig config)
        Description copied from class: JsonDeserializer
        Introspection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not. Return value should either be Boolean.FALSE if update is not supported at all (immutable values); Boolean.TRUE if update should usually work (regular POJOs, for example), or null if this is either not known, or may sometimes work.

        Information gathered is typically used to either prevent merging update for property (either by skipping, if based on global defaults; or by exception during deserialization construction if explicit attempt made) if Boolean.FALSE returned, or inclusion if Boolean.TRUE is specified. If "unknown" case (null returned) behavior is to exclude property if global defaults used; or to allow if explicit per-type or property merging is defined.

        Default implementation returns null to allow explicit per-type or per-property attempts.

        supportsUpdate in class JsonDeserializer<Object>
      • handledType

        public Class<?> handledType()
        Description copied from class: JsonDeserializer
        Method for accessing concrete physical type of values this deserializer produces. Note that this information is not guaranteed to be exact -- it may be a more generic (super-type) -- but it should not be incorrect (return a non-related type).

        Default implementation will return null, which means almost same same as returning Object.class would; that is, that nothing is known about handled type.

        handledType in class StdDeserializer<Object>
        Physical type of values this deserializer produces, if known; null if not
      • getObjectIdReader

        public ObjectIdReader getObjectIdReader()
        Overridden to return true for those instances that are handling value for which Object Identity handling is enabled (either via value type or referring property).
        getObjectIdReader in class JsonDeserializer<Object>
        ObjectIdReader used for resolving possible Object Identifier value, instead of full value serialization, if deserializer can do that; null if no Object Id is expected.
      • hasProperty

        public boolean hasProperty​(String propertyName)
      • hasViews

        public boolean hasViews()
      • getPropertyCount

        public int getPropertyCount()
        Accessor for checking number of deserialized properties.
      • getKnownPropertyNames

        public Collection<Object> getKnownPropertyNames()
        Description copied from class: JsonDeserializer
        Method that will either return null to indicate that type being deserializers has no concept of properties; or a collection of identifiers for which toString will give external property name. This is only to be used for error reporting and diagnostics purposes (most commonly, to accompany "unknown property" exception).
        getKnownPropertyNames in class JsonDeserializer<Object>
      • logicalType

        public LogicalType logicalType()
        Description copied from class: JsonDeserializer
        Method for accessing logical type of values this deserializer produces. Typically used for further configuring handling of values, for example, to find which coercions are legal.
        logicalType in class JsonDeserializer<Object>
        Logical type of values this deserializer produces, if known; null if not
      • properties

        public Iterator<SettableBeanProperty> properties()
        Accessor for iterating over properties this deserializer uses; with the exception that properties passed via Creator methods (specifically, "property-based constructor") are not included, but can be accessed separate by calling creatorProperties()
      • creatorProperties

        public Iterator<SettableBeanProperty> creatorProperties()
        Accessor for finding properties that represents values to pass through property-based creator method (constructor or factory method)
      • findProperty

        public SettableBeanProperty findProperty​(String propertyName)
        Accessor for finding the property with given name, if POJO has one. Name used is the external name, i.e. name used in external data representation (JSON).
      • findProperty

        public SettableBeanProperty findProperty​(int propertyIndex)
        Alternate find method that tries to locate a property with given property index. Note that access by index is not necessarily faster than by name, since properties are not directly indexable; however, for most instances difference is not significant as number of properties is low.
      • replaceProperty

        public void replaceProperty​(SettableBeanProperty original,
                                    SettableBeanProperty replacement)
        Method that can be used to replace an existing property with a modified one.

        NOTE: only ever use this method if you know what you are doing; incorrect usage can break deserializer.

        original - Property to replace
        replacement - Property to replace it with
      • wrapAndThrow

        public void wrapAndThrow​(Throwable t,
                                 Object bean,
                                 String fieldName,
                                 DeserializationContext ctxt)
                          throws IOException
        Method that will modify caught exception (passed in as argument) as necessary to include reference information, and to ensure it is a subtype of IOException, or an unchecked exception.

        Rules for wrapping and unwrapping are bit complicated; essentially:

        • Errors are to be passed as is (if uncovered via unwrapping)
        • "Plain" IOExceptions (ones that are not of type JsonMappingException are to be passed as is