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:
jakarta.json.bind.serializer.JsonbDeserializer<T>
,RuntimeTypeInfo
,CurrentItem<T>
- Direct Known Subclasses:
AbstractArrayDeserializer
,AbstractJsonpDeserializer
,MapDeserializer
,UserDeserializerDeserializer
public abstract class AbstractContainerDeserializer<T> extends AbstractItem<T> implements jakarta.json.bind.serializer.JsonbDeserializer<T>
Base class for all deserializers producing non single value result. Deserialize bean objects, collections, maps, arrays, etc.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
appendResult(java.lang.Object result)
After object is transitively deserialized from JSON, "append" it to its wrapper.protected java.lang.Object
convertNullToOptionalEmpty(java.lang.reflect.Type propertyType, java.lang.Object value)
If value is null and property model type is one ofOptional
,OptionalDouble
,OptionalInt
, orOptionalLong
, value of correspondingOptional#empty()
is returned.T
deserialize(jakarta.json.stream.JsonParser parser, jakarta.json.bind.serializer.DeserializationContext context, java.lang.reflect.Type rtType)
Drives JSONPJsonParser
to deserialize json document.protected void
deserializeInternal(JsonbParser parser, Unmarshaller context)
Deserialize specific item type.protected abstract void
deserializeNext(jakarta.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 jakarta.json.bind.serializer.JsonbDeserializer<?>
newCollectionOrMapItem(java.lang.reflect.Type valueType, JsonbContext ctx)
Returns new deserialization builder for specific collection or map.protected DeserializerBuilder
newUnmarshallerItemBuilder(JsonbContext ctx)
Returns new deserialization builder for specific item.-
Methods inherited from class org.eclipse.yasson.internal.serializer.AbstractItem
getClassModel, getRuntimeType, getWrapper
-
-
-
-
Method Detail
-
deserialize
public final T deserialize(jakarta.json.stream.JsonParser parser, jakarta.json.bind.serializer.DeserializationContext context, java.lang.reflect.Type rtType)
Drives JSONPJsonParser
to deserialize json document.- Specified by:
deserialize
in interfacejakarta.json.bind.serializer.JsonbDeserializer<T>
- Parameters:
parser
- JSON parser.context
- Deseriaization context.rtType
- Runtime type.- Returns:
- Instance of a type for this item.
-
getInstance
protected abstract T getInstance(Unmarshaller unmarshaller)
Creates and initializes an instance of deserializing item.- Parameters:
unmarshaller
- Current deserialization context.- Returns:
- An instance of deserializing item.
-
deserializeInternal
protected void deserializeInternal(JsonbParser parser, Unmarshaller context)
Deserialize specific item type.- Parameters:
parser
- jsonb parsercontext
- context
-
deserializeNext
protected abstract void deserializeNext(jakarta.json.stream.JsonParser parser, Unmarshaller context)
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
protected abstract JsonbRiParser.LevelContext moveToFirst(JsonbParser parser)
Move to first event for current deserializer structure.- Parameters:
parser
- Json parser.- Returns:
- First event.
-
newUnmarshallerItemBuilder
protected DeserializerBuilder newUnmarshallerItemBuilder(JsonbContext ctx)
Returns new deserialization builder for specific item.- Parameters:
ctx
- jsonb context- Returns:
- deserialization builder
-
newCollectionOrMapItem
protected jakarta.json.bind.serializer.JsonbDeserializer<?> newCollectionOrMapItem(java.lang.reflect.Type valueType, JsonbContext ctx)
Returns new deserialization builder for specific collection or map.- Parameters:
valueType
- value typectx
- jsonb context- Returns:
- deserialization builder
-
convertNullToOptionalEmpty
protected java.lang.Object convertNullToOptionalEmpty(java.lang.reflect.Type propertyType, java.lang.Object value)
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
public abstract void appendResult(java.lang.Object result)
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.
-
-