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.

@FunctionalInterface public interface NullableDeserializer<T> extends Deserializer<T>
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).
  • 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: Deserializer
      Deserializes from the current state of the Decoder an object of type Deserializer.
      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 or null only if Deserializer.allowNull() returns true
      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: Deserializer
      Deserializes from the current state of the Decoder an object of type Deserializer. 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
    • 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 decoder
      decoderContext - The decoder context
      type - The type
      Returns:
      The value
      Throws:
      IOException - if something goes wrong during deserialization