Interface Deserializer<T>
- Type Parameters:
T- The generic type that the deserializer can deserialize
- All Known Subinterfaces:
CustomizableDeserializer<T>, DeserializerRegistrar<T>, NullableDeserializer<T>, NullableSerde<T>, NumberSerde<N>, Serde<T>, SerdeRegistrar<T>, TemporalSerde<T>, UpdatingDeserializer<T>
- All Known Implementing Classes:
AbstractBsonSerde, AbstractOracleJsonSerde, BsonRepresentationSerde, ByteBufferSerde, CodecBsonDecoder, CustomizedObjectArrayDeserializer, DefaultFormattedTemporalSerde, HealthStatusSerde, InetAddressSerde, InstantSerde, LocalDateSerde, LocalDateTimeSerde, LocalTimeSerde, ObjectArraySerde, ObjectDeserializer, OffsetDateTimeSerde, OracleJsonBinarySerde, OracleJsonDurationSerde, OracleJsonLocaleDateSerde, OracleJsonLocaleDateTimeSerde, OracleJsonLocaleTimeSerde, OracleJsonOffsetDateTimeSerde, OracleJsonZonedDateTimeSerde, YearSerde, ZonedDateTimeSerde
Interface that represents a deserializer.
- Author:
- Jonas Konrad, graemerocher
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceContext object passed to thedeserialize(Decoder, io.micronaut.serde.Deserializer.DecoderContext, io.micronaut.core.type.Argument)method along with the decoder. -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull Deserializer<T> createSpecific(@NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) Create a new child deserializer or return this if non is necessary for the given context.@Nullable Tdeserialize(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) default TdeserializeNullable(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) default @Nullable TgetDefaultValue(@NonNull Deserializer.DecoderContext context, @NonNull 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.
-
Method Details
-
createSpecific
default @NonNull Deserializer<T> createSpecific(@NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws SerdeException Create a new child deserializer or return this if non is necessary for the given context.- Parameters:
context- The decoder contexttype- The context, including any annotation metadata and type information to narrow the deserializer type- Returns:
- An instance of the same type of deserializer
- Throws:
SerdeException
-
deserialize
@Nullable T deserialize(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws IOException - 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
-
deserializeNullable
default T deserializeNullable(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws IOException Deserializes from the current state of theDecoderan object of typeT. If the decoder value isnull, this must be permitted. By default, in this case, this method will returnnull.- 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- Since:
- 2.0.0
-
getDefaultValue
default @Nullable T getDefaultValue(@NonNull Deserializer.DecoderContext context, @NonNull 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.- Parameters:
context- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The default value
-