Class ErrorCatchingDeserializer<T>
java.lang.Object
io.micronaut.serde.support.deserializers.ErrorCatchingDeserializer<T>
- Type Parameters:
T- The deserializer type
- All Implemented Interfaces:
Deserializer<T>
The error catching
Deserializer.- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from interface Deserializer
Deserializer.DecoderContext -
Method Summary
Modifier and TypeMethodDescriptioncreateSpecific(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.deserialize(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) @Nullable TdeserializeNullable(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) @Nullable 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.final Deserializer<T> Returns the wrapped deserializer, exposed for testing.
-
Method Details
-
createSpecific
public Deserializer<T> createSpecific(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws SerdeException Description copied from interface:DeserializerCreate a new child deserializer or return this if non is necessary for the given context.- Specified by:
createSpecificin interfaceDeserializer<T>- 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
public T deserialize(Decoder decoder, Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws IOException Description copied from interface:Deserializer- Specified by:
deserializein interfaceDeserializer<T>- Parameters:
decoder- The decoder, nevernullcontext- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The deserialized object, never
null. UseDeserializer.deserializeNullable(Decoder, DecoderContext, Argument)when the decoder value can benull. - Throws:
IOException- If an error occurs during deserialization of the object
-
deserializeNullable
public @Nullable T deserializeNullable(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 typeT. 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
-
getDefaultValue
public @Nullable 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
-
getDeserializer
Returns the wrapped deserializer, exposed for testing.- Returns:
- The wrapped deserializer, exposed for testing
-