Class AbstractContainerDeserializer<T>
java.lang.Object
org.eclipse.yasson.internal.serializer.AbstractItem<T>
org.eclipse.yasson.internal.serializer.AbstractContainerDeserializer<T>
- Type Parameters:
T
- container type
- All Implemented Interfaces:
javax.json.bind.serializer.JsonbDeserializer<T>
,RuntimeTypeInfo
,CurrentItem<T>
- Direct Known Subclasses:
AbstractArrayDeserializer
,AbstractJsonpDeserializer
,MapDeserializer
,UserDeserializerDeserializer
public abstract class AbstractContainerDeserializer<T>
extends AbstractItem<T>
implements javax.json.bind.serializer.JsonbDeserializer<T>
Base class for all deserializers producing non single value result.
Deserialize bean objects, collections, maps, arrays, etc.
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
appendResult(Object result, Unmarshaller context)
After object is transitively deserialized from JSON, "append" it to its wrapper.protected Object
convertNullToOptionalEmpty(Type propertyType, Object value)
If value is null and property model type is one ofOptional
,OptionalDouble
,OptionalInt
, orOptionalLong
, value of correspondingOptional#empty()
is returned.deserialize(javax.json.stream.JsonParser parser, javax.json.bind.serializer.DeserializationContext context, Type rtType)
Drives JSONPJsonParser
to deserialize json document.protected void
deserializeInternal(JsonbParser parser, Unmarshaller context)
Deserialize specific item type.protected abstract void
deserializeNext(javax.json.stream.JsonParser parser, Unmarshaller context)
Determine class mappings and create an instance of a new deserializer.protected abstract T
getInstance(Unmarshaller unmarshaller)
Creates and initializes an instance of deserializing item.protected abstract JsonbRiParser.LevelContext
moveToFirst(JsonbParser parser)
Move to first event for current deserializer structure.protected javax.json.bind.serializer.JsonbDeserializer<?>
newCollectionOrMapItem(Type valueType, JsonbContext ctx)
Returns new deserialization builder for specific collection or map.protected DeserializerBuilder
Returns new deserialization builder for specific item.Methods inherited from class org.eclipse.yasson.internal.serializer.AbstractItem
getClassModel, getRuntimeType, getWrapper
-
Method Details
-
deserialize
public final T deserialize(javax.json.stream.JsonParser parser, javax.json.bind.serializer.DeserializationContext context, Type rtType)Drives JSONPJsonParser
to deserialize json document.- Specified by:
deserialize
in interfacejavax.json.bind.serializer.JsonbDeserializer<T>
- Parameters:
parser
- JSON parser.context
- Deseriaization context.rtType
- Runtime type.- Returns:
- Instance of a type for this item.
-
getInstance
Creates and initializes an instance of deserializing item.- Parameters:
unmarshaller
- Current deserialization context.- Returns:
- An instance of deserializing item.
-
deserializeInternal
Deserialize specific item type.- Parameters:
parser
- jsonb parsercontext
- context
-
deserializeNext
Determine class mappings and create an instance of a new deserializer. Currently processed deserializer is pushed to stack, for waiting till new object is finished.- Parameters:
parser
- Json parser.context
- Current unmarshalling context.
-
moveToFirst
Move to first event for current deserializer structure.- Parameters:
parser
- Json parser.- Returns:
- First event.
-
newUnmarshallerItemBuilder
Returns new deserialization builder for specific item.- Parameters:
ctx
- jsonb context- Returns:
- deserialization builder
-
newCollectionOrMapItem
protected javax.json.bind.serializer.JsonbDeserializer<?> newCollectionOrMapItem(Type valueType, JsonbContext ctx)Returns new deserialization builder for specific collection or map.- Parameters:
valueType
- value typectx
- jsonb context- Returns:
- deserialization builder
-
convertNullToOptionalEmpty
If value is null and property model type is one ofOptional
,OptionalDouble
,OptionalInt
, orOptionalLong
, value of correspondingOptional#empty()
is returned.- Parameters:
propertyType
- property typevalue
- value to set- Returns:
- empty optional if applies
-
appendResult
After object is transitively deserialized from JSON, "append" it to its wrapper. In case of a field set value to field, in case of collections or other embedded objects use methods provided.- Parameters:
result
- An instance result of an item.context
- Current unmarshalling context.
-