Class ObjectShapeSerdeHelper

java.lang.Object
io.micronaut.serde.support.util.ObjectShapeSerdeHelper

@Internal public final class ObjectShapeSerdeHelper extends Object
Common helpers for POJO-like shape handling.
Since:
3.0
Author:
Denis Stepanov
  • Method Details

    • objectSerializer

      public static <T> Serializer<T> objectSerializer(Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
      Select the generic object serializer for POJO-like shape handling.
      Type Parameters:
      T - The serialized type
      Parameters:
      context - The encoder context
      type - The type
      Returns:
      The object serializer
      Throws:
      SerdeException
    • objectDeserializer

      public static <T> Deserializer<T> objectDeserializer(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws SerdeException
      Select the generic object deserializer for POJO-like shape handling.
      Type Parameters:
      T - The deserialized type
      Parameters:
      context - The decoder context
      type - The type
      Returns:
      The object deserializer
      Throws:
      SerdeException
    • updatingObjectDeserializer

      public static <T> @Nullable UpdatingDeserializer<T> updatingObjectDeserializer(Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws SerdeException
      Select the generic object deserializer only when it supports updating this type.

      This is used as a merge fallback for generated deserializers that are replace-only. If the type is not object-shaped, the generic object deserializer may not be able to create a specific deserializer. In that case there is no updating fallback and callers should keep replacement semantics.

      Type Parameters:
      T - The deserialized type
      Parameters:
      context - The decoder context
      type - The type
      Returns:
      The updating object deserializer, or null if the type cannot be updated through the object path
      Throws:
      SerdeException