T
- The generic type that the deserializer can deserialize@Indexed(value=Deserializer.class) public interface Deserializer<T>
Modifier and Type | Interface and Description |
---|---|
static interface |
Deserializer.DecoderContext
Context object passed to the
deserialize(Decoder, io.micronaut.serde.Deserializer.DecoderContext, io.micronaut.core.type.Argument) method along with the decoder. |
Modifier and Type | Method and Description |
---|---|
default boolean |
allowNull() |
default Deserializer<T> |
createSpecific(Deserializer.DecoderContext context,
io.micronaut.core.type.Argument<? super T> type)
Create a new child deserializer or return this if non is necessary for the given context.
|
T |
deserialize(Decoder decoder,
Deserializer.DecoderContext context,
io.micronaut.core.type.Argument<? super T> type)
Deserializes from the current state of the
Decoder an object of type T . |
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.
|
@NonNull default Deserializer<T> createSpecific(@NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws SerdeException
context
- The decoder contexttype
- The context, including any annotation metadata and type information to narrow the deserializer typeSerdeException
@Nullable T deserialize(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws java.io.IOException
Decoder
an object of type T
.decoder
- The decoder, never null
context
- The decoder context, never null
type
- The generic type to be deserializednull
only if allowNull()
returns true
java.io.IOException
- If an error occurs during deserialization of the objectdefault boolean allowNull()
null
@Nullable default T getDefaultValue(@NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type)
context
- The decoder context, never null
type
- The generic type to be deserialized