Package org.dice_research.serial.maps
Class AbstractComplexMapDeserializer<T extends Map<Object,Object>>
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonDeserializer<T>
-
- com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
-
- org.dice_research.serial.maps.AbstractComplexMapDeserializer<T>
-
- 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 ofMapinstances that have been serialized with theComplexMapSerializer. Note that the class itself is abstract. Extending classes need to provide aSupplierto create instances of theMapinterface. 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
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 classAbstractComplexMapDeserializer.LocalClassLoader
-
Field Summary
Fields Modifier and Type Field Description private static AbstractComplexMapDeserializer.LocalClassLoaderLOCAL_CLASS_LOADERprivate Supplier<T>mapFactoryThe factory that is used to generateMapinstances when needed.private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description AbstractComplexMapDeserializer(Supplier<T> mapFactory)Constructor.AbstractComplexMapDeserializer(Supplier<T> mapFactory, Class<?> t)Constructor taking additional type that this deserializer can process.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tdeserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext ctxt)protected Class<?>loadClass(String className)This method tries to get aClassobject for the given class name.protected voidparseElement(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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
LOCAL_CLASS_LOADER
private static final AbstractComplexMapDeserializer.LocalClassLoader LOCAL_CLASS_LOADER
-
-
Constructor Detail
-
AbstractComplexMapDeserializer
public AbstractComplexMapDeserializer(Supplier<T> mapFactory)
Constructor.- Parameters:
mapFactory- the factory that is used to generateMapinstances when needed
-
-
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:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<T extends Map<Object,Object>>- Throws:
IOExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
parseElement
protected void parseElement(com.fasterxml.jackson.core.JsonParser parser, Class<?> mainKeyClass, Class<?> mainValueClass, Map<Object,Object> resultMap) throws IOExceptionThis 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 objectmainKeyClass- 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 aClassobject for the given class name.- Parameters:
className- the name of the class that should be loaded- Returns:
- the
Classobject representing this class - Throws:
IOException- in case the class couldn't be identified
-
-