Class ErrorCatchingDeserializer<T>

java.lang.Object
io.micronaut.serde.support.deserializers.ErrorCatchingDeserializer<T>
Type Parameters:
T - The deserializer type
All Implemented Interfaces:
Deserializer<T>

@Internal public class ErrorCatchingDeserializer<T> extends Object implements Deserializer<T>
The error catching Deserializer.
Author:
Denis Stepanov
  • Method Details

    • createSpecific

      public Deserializer<T> createSpecific(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws SerdeException
      Description copied from interface: Deserializer
      Create a new child deserializer or return this if non is necessary for the given context.
      Specified by:
      createSpecific in interface Deserializer<T>
      Parameters:
      context - The decoder context
      type - 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
      Deserializes from the current state of the Decoder an object of type T.
      Specified by:
      deserialize in interface Deserializer<T>
      Parameters:
      decoder - The decoder, never null
      context - The decoder context, never null
      type - The generic type to be deserialized
      Returns:
      The deserialized object, never null. Use Deserializer.deserializeNullable(Decoder, DecoderContext, Argument) when the decoder value can be null.
      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: Deserializer
      Deserializes from the current state of the Decoder an object of type T. If the decoder value is null, this must be permitted. By default, in this case, this method will return null.
      Specified by:
      deserializeNullable in interface Deserializer<T>
      Parameters:
      decoder - The decoder, never null
      context - The decoder context, never null
      type - 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: Deserializer
      Obtains a default value that can be returned from this deserializer in the case where a value is absent.
      Specified by:
      getDefaultValue in interface Deserializer<T>
      Parameters:
      context - The decoder context, never null
      type - The generic type to be deserialized
      Returns:
      The default value
    • getDeserializer

      public final Deserializer<T> getDeserializer()
      Returns the wrapped deserializer, exposed for testing.
      Returns:
      The wrapped deserializer, exposed for testing