Package io.micronaut.serde.util
Interface CustomizableDeserializer<T>
- Type Parameters:
T- The deserializer type
- All Superinterfaces:
Deserializer<T>
- All Known Implementing Classes:
ObjectArraySerde,ObjectDeserializer
The type of deserializer that requires a specific implementation by calling
Deserializer.createSpecific(DecoderContext, Argument).- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.serde.Deserializer
Deserializer.DecoderContext -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturn true if the decoder can accept the null value by converting it to something else or just returning null.default Tdeserialize(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) Deserializes from the current state of theDecoderan object of typeDeserializer.default TdeserializeNullable(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) Deserializes from the current state of theDecoderan object of typeDeserializer.default TgetDefaultValue(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) Obtains a default value that can be returned from this deserializer in the case where a value is absent.Methods inherited from interface io.micronaut.serde.Deserializer
createSpecific
-
Method Details
-
deserialize
default T deserialize(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws IOException Description copied from interface:DeserializerDeserializes from the current state of theDecoderan object of typeDeserializer.- Specified by:
deserializein interfaceDeserializer<T>- Parameters:
decoder- The decoder, nevernullcontext- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The deserialized object or
nullonly ifDeserializer.allowNull()returnstrue - Throws:
IOException- If an error occurs during deserialization of the object
-
deserializeNullable
default T deserializeNullable(@NonNull @NonNull Decoder decoder, @NonNull @NonNull Deserializer.DecoderContext context, @NonNull @NonNull io.micronaut.core.type.Argument<? super T> type) throws IOException Description copied from interface:DeserializerDeserializes from the current state of theDecoderan object of typeDeserializer. If the decoder value isnull, this must be permitted. By default, in this case, this method will returnnull.- Specified by:
deserializeNullablein interfaceDeserializer<T>- Parameters:
decoder- The decoder, nevernullcontext- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The deserialized object or
null - Throws:
IOException- If an error occurs during deserialization of the object
-
allowNull
default boolean allowNull()Description copied from interface:DeserializerReturn true if the decoder can accept the null value by converting it to something else or just returning null.- Specified by:
allowNullin interfaceDeserializer<T>- Returns:
- Whether the deserializer is allowed to emit
null
-
getDefaultValue
default T getDefaultValue(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) Description copied from interface:DeserializerObtains a default value that can be returned from this deserializer in the case where a value is absent.- Specified by:
getDefaultValuein interfaceDeserializer<T>- Parameters:
context- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The default value
-