Interface Deserializer<T>

Type Parameters:
T - The generic type that the deserializer can deserialize
All Known Subinterfaces:
CustomizableDeserializer<T>, NullableDeserializer<T>, NullableSerde<T>, NumberSerde<N>, Serde<T>, TemporalSerde<T>, UpdatingDeserializer<T>
All Known Implementing Classes:
AbstractBsonSerde, AbstractOracleJsonSerde, BsonRepresentationSerde, CodecBsonDecoder, CustomizedObjectArrayDeserializer, DefaultFormattedTemporalSerde, HealthStatusSerde, InstantSerde, LocalDateSerde, LocalDateTimeSerde, LocalTimeSerde, ObjectArraySerde, ObjectDeserializer, OffsetDateTimeSerde, OracleJsonBinarySerde, OracleJsonDurationSerde, OracleJsonLocaleDateSerde, OracleJsonLocaleDateTimeSerde, OracleJsonLocaleTimeSerde, OracleJsonOffsetDateTimeSerde, OracleJsonZonedDateTimeSerde, YearSerde, ZonedDateTimeSerde

@Indexed(Deserializer.class) public interface Deserializer<T>
Interface that represents a deserializer.
Author:
Jonas Konrad, graemerocher
  • Method Details

    • createSpecific

      @NonNull default 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 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

      @Nullable T deserialize(@NonNull Decoder decoder, @NonNull Deserializer.DecoderContext context, @NonNull io.micronaut.core.type.Argument<? super T> type) throws IOException
      Deserializes from the current state of the Decoder an object of type Deserializer.
      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 allowNull() returns true
      Throws:
      IOException - If an error occurs during deserialization of the object
    • allowNull

      default boolean allowNull()
      Return true if the decoder can accept the null value by converting it to something else or just returning null.
      Returns:
      Whether the deserializer is allowed to emit null
    • getDefaultValue

      @Nullable default 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, never null
      type - The generic type to be deserialized
      Returns:
      The default value