Class AbstractComplexMapDeserializer<T extends Map<Object,​Object>>

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.deser.NullValueProvider, com.fasterxml.jackson.databind.deser.ValueInstantiator.Gettable, Serializable
    Direct Known Subclasses:
    ComplexHashMapDeserializer

    public abstract class AbstractComplexMapDeserializer<T extends Map<Object,​Object>>
    extends com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
    This class handles the deserialization of Map instances that have been serialized with the ComplexMapSerializer. Note that the class itself is abstract. Extending classes need to provide a Supplier to create instances of the Map interface. The main deserialization method implements a finite state automaton. States are as follows:
    • 0 = end of map reached
    • 1 = within the JSON object representing the map
    • 2 = found main key class field
    • 3 = found main value class field
    • 4 = found array of map elements
    • 5 = found undefined field. It will be ignored
    • 6 = found start of the array of map elements
    The parseElement(JsonParser, Class, Class, Map) method for deserializing single map elements implements a finite state automaton. States are as follows:
    • 1 = within the JSON object representing the element
    • 2 = found main key class field
    • 3 = found main value class field
    • 4 = found main key field
    • 5 = found main value field
    • 6 = found undefined field. It will be ignored
    • 6 = array of map elements started
    Author:
    Michael Röder (michael.roeder@uni-paderborn.de)
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  AbstractComplexMapDeserializer.LocalClassLoader  
      • Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer

        com.fasterxml.jackson.databind.JsonDeserializer.None
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T deserialize​(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext ctxt)  
      protected Class<?> loadClass​(String className)
      This method tries to get a Class object for the given class name.
      protected void parseElement​(com.fasterxml.jackson.core.JsonParser parser, Class<?> mainKeyClass, Class<?> mainValueClass, Map<Object,​Object> resultMap)
      This method parses the single elements of the map object.
      • Methods inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer

        _byteOverflow, _checkCoercionFail, _checkDoubleSpecialValue, _checkFloatSpecialValue, _checkFloatToIntCoercion, _checkFromStringCoercion, _checkFromStringCoercion, _checkTextualNull, _coerceBooleanFromInt, _coercedTypeDesc, _coerceEmptyString, _coerceIntegral, _coerceNullToken, _coerceTextualNull, _deserializeFromArray, _deserializeFromEmpty, _deserializeFromEmptyString, _deserializeFromString, _deserializeWrappedValue, _failDoubleToIntCoercion, _findCoercionFromBlankString, _findCoercionFromEmptyArray, _findCoercionFromEmptyString, _findNullProvider, _hasTextualNull, _intOverflow, _isBlank, _isEmptyOrTextualNull, _isFalse, _isIntNumber, _isNaN, _isNegInf, _isPosInf, _isTrue, _neitherNull, _nonNullNumber, _parseBoolean, _parseBooleanFromInt, _parseBooleanPrimitive, _parseBooleanPrimitive, _parseBytePrimitive, _parseDate, _parseDate, _parseDateFromArray, _parseDouble, _parseDoublePrimitive, _parseDoublePrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseInteger, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _reportFailedNullCoerce, _shortOverflow, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, deserializeWithType, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer
      • Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer

        deserialize, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
    • Constructor Detail

      • AbstractComplexMapDeserializer

        public AbstractComplexMapDeserializer​(Supplier<T> mapFactory)
        Constructor.
        Parameters:
        mapFactory - the factory that is used to generate Map instances when needed
      • AbstractComplexMapDeserializer

        public AbstractComplexMapDeserializer​(Supplier<T> mapFactory,
                                              Class<?> t)
        Constructor taking additional type that this deserializer can process.
        Parameters:
        mapFactory - the factory that is used to generate Map instances when needed
        t - Type of values this deserializer handles: sometimes exact types, other time most specific supertype of types deserializer handles (which may be as generic as Object in some case)
    • Method Detail

      • deserialize

        public T deserialize​(com.fasterxml.jackson.core.JsonParser parser,
                             com.fasterxml.jackson.databind.DeserializationContext ctxt)
                      throws IOException,
                             com.fasterxml.jackson.core.JsonProcessingException
        Specified by:
        deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<T extends Map<Object,​Object>>
        Throws:
        IOException
        com.fasterxml.jackson.core.JsonProcessingException
      • parseElement

        protected void parseElement​(com.fasterxml.jackson.core.JsonParser parser,
                                    Class<?> mainKeyClass,
                                    Class<?> mainValueClass,
                                    Map<Object,​Object> resultMap)
                             throws IOException
        This method parses the single elements of the map object. See class description for a detailed description of its internal states.
        Parameters:
        parser - the JSON parser that currently looks at the beginning of an element object
        mainKeyClass - the class that will be assumed to be the class of the key of an element (if not defined otherwise within the element object)
        mainValueClass - the class that will be assumed to be the class of the value of an element (if not defined otherwise within the element object)
        resultMap - the map to which the read element should be added to
        Throws:
        IOException - in case the parser throws an exception
      • loadClass

        protected Class<?> loadClass​(String className)
                              throws IOException
        This method tries to get a Class object for the given class name.
        Parameters:
        className - the name of the class that should be loaded
        Returns:
        the Class object representing this class
        Throws:
        IOException - in case the class couldn't be identified