Interface Serializer<T>

Type Parameters:
T - The type to be serialized
All Known Subinterfaces:
CustomizableSerializer<T>, NullableSerde<T>, NumberSerde<N>, ObjectSerializer<T>, Serde<T>, SerdeRegistrar<T>, SerializerRegistrar<T>, TemporalSerde<T>
All Known Implementing Classes:
AbstractBsonSerde, AbstractOracleJsonSerde, BsonRepresentationSerde, ByteBufferSerde, CodecBsonDecoder, CustomizedObjectArraySerializer, DefaultFormattedTemporalSerde, HealthStatusSerde, InetAddressSerde, InstantSerde, LocalDateSerde, LocalDateTimeSerde, LocalTimeSerde, ObjectArraySerde, ObjectSerializer, OffsetDateTimeSerde, OracleJsonBinarySerde, OracleJsonDurationSerde, OracleJsonLocaleDateSerde, OracleJsonLocaleDateTimeSerde, OracleJsonLocaleTimeSerde, OracleJsonOffsetDateTimeSerde, OracleJsonZonedDateTimeSerde, YearSerde, ZonedDateTimeSerde

@Indexed(Serializer.class) public interface Serializer<T>
Models a build time serializer. That is a class computed at build-time that can be used to serialize an instance of Serializer.
Jonas Konrad, graemerocher
  • Method Details

    • createSpecific

      @NonNull default @NonNull Serializer<T> createSpecific(@NonNull @NonNull Serializer.EncoderContext context, @NonNull @NonNull io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
      Create a more specific serializer for the given definition.
      context - The encoder context
      type - The type definition including any annotation metadata
      The more specific serializer
    • serialize

      void serialize(@NonNull @NonNull Encoder encoder, @NonNull @NonNull Serializer.EncoderContext context, @NonNull @NonNull io.micronaut.core.type.Argument<? extends T> type, @NonNull T value) throws IOException
      Serializes the given value using the passed Encoder.
      encoder - The encoder to use
      context - The encoder context, never null
      type - Models the generic type of the value
      value - The value, can be null
      IOException - If an error occurs during serialization
    • isEmpty

      default boolean isEmpty(@NonNull @NonNull Serializer.EncoderContext context, @Nullable T value)
      Used for JsonInclude.Include#NON_EMPTY checking.
      context - The encoder context
      value - The check to check
      Return true if the value is empty
    • isAbsent

      default boolean isAbsent(@NonNull @NonNull Serializer.EncoderContext context, @Nullable T value)
      Used for JsonInclude.Include#NON_ABSENT checking.
      context - The encoder context
      value - The value to check
      Return true if the value is absent