Package io.micronaut.serde.util
Interface NullableDeserializer<T>
- Type Parameters:
T- The type to deserialize
- All Superinterfaces:
Deserializer<T>
- All Known Subinterfaces:
NullableSerde<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Sub-interface of
Deserializer for deserializers that allow
null. Deals with the decoding of null and delegates to deserializeNonNull(io.micronaut.serde.Decoder, io.micronaut.serde.Deserializer.DecoderContext, io.micronaut.core.type.Argument).-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.serde.Deserializer
Deserializer.DecoderContext -
Method Summary
Modifier and TypeMethodDescriptiondefault Tdeserialize(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) Deserializes from the current state of theDecoderan object of typeDeserializer.deserializeNonNull(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super T> type) A method that is invoked when the value is known not to be null.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.Methods inherited from interface io.micronaut.serde.Deserializer
allowNull, createSpecific, getDefaultValue
-
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
-
deserializeNonNull
@NonNull T deserializeNonNull(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super T> type) throws IOException A method that is invoked when the value is known not to be null.- Parameters:
decoder- The decoderdecoderContext- The decoder contexttype- The type- Returns:
- The value
- Throws:
IOException- if something goes wrong during deserialization
-