Interface Deserializer<T>

Type Parameters:
T - The generic type that the deserializer can deserialize
All Known Subinterfaces:
CustomizableDeserializer<T>, DeserializerRegistrar<T>, NullableDeserializer<T>, NullableSerde<T>, NumberSerde<N>, Serde<T>, SerdeRegistrar<T>, TemporalSerde<T>, UpdatingDeserializer<T>
All Known Implementing Classes:
AbstractBsonSerde, AbstractOracleJsonSerde, BsonRepresentationSerde, ByteBufferSerde, CodecBsonDecoder, CustomizedObjectArrayDeserializer, DefaultFormattedTemporalSerde, HealthStatusSerde, InetAddressSerde, 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 @NonNull Deserializer<T> createSpecific(@NonNull @NonNull Deserializer.DecoderContext context, @NonNull @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 @NonNull Decoder decoder, @NonNull @NonNull Deserializer.DecoderContext context, @NonNull @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
    • 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
      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.
      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
      Since:
      2.0.0
    • allowNull

      @Deprecated 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 @NonNull Deserializer.DecoderContext context, @NonNull @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