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 boolean
Return true if the decoder can accept the null value by converting it to something else or just returning null.default T
deserialize
(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) Deserializes from the current state of theDecoder
an object of typeDeserializer
.default T
deserializeNullable
(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) Deserializes from the current state of theDecoder
an object of typeDeserializer
.default T
getDefaultValue
(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:Deserializer
Deserializes from the current state of theDecoder
an object of typeDeserializer
.- Specified by:
deserialize
in interfaceDeserializer<T>
- Parameters:
decoder
- The decoder, nevernull
context
- The decoder context, nevernull
type
- The generic type to be deserialized- Returns:
- The deserialized object or
null
only 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:Deserializer
Deserializes from the current state of theDecoder
an object of typeDeserializer
. If the decoder value isnull
, this must be permitted. By default, in this case, this method will returnnull
.- Specified by:
deserializeNullable
in interfaceDeserializer<T>
- Parameters:
decoder
- The decoder, nevernull
context
- The decoder context, nevernull
type
- 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:Deserializer
Return true if the decoder can accept the null value by converting it to something else or just returning null.- Specified by:
allowNull
in 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:Deserializer
Obtains a default value that can be returned from this deserializer in the case where a value is absent.- Specified by:
getDefaultValue
in interfaceDeserializer<T>
- Parameters:
context
- The decoder context, nevernull
type
- The generic type to be deserialized- Returns:
- The default value
-