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
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> io.micronaut.serde.Deserializer<T>
    objectDeserializer(io.micronaut.serde.Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type)
    Select the generic object deserializer for POJO-like shape handling.
    static <T> io.micronaut.serde.Serializer<T>
    objectSerializer(io.micronaut.serde.Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type)
    Select the generic object serializer for POJO-like shape handling.
    static <T> @Nullable io.micronaut.serde.UpdatingDeserializer<T>
    updatingObjectDeserializer(io.micronaut.serde.Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type)
    Select the generic object deserializer only when it supports updating this type.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • objectSerializer

      public static <T> io.micronaut.serde.Serializer<T> objectSerializer(io.micronaut.serde.Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) throws io.micronaut.serde.exceptions.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:
      io.micronaut.serde.exceptions.SerdeException
    • objectDeserializer

      public static <T> io.micronaut.serde.Deserializer<T> objectDeserializer(io.micronaut.serde.Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws io.micronaut.serde.exceptions.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:
      io.micronaut.serde.exceptions.SerdeException
    • updatingObjectDeserializer

      public static <T> @Nullable io.micronaut.serde.UpdatingDeserializer<T> updatingObjectDeserializer(io.micronaut.serde.Deserializer.DecoderContext context, io.micronaut.core.type.Argument<? super T> type) throws io.micronaut.serde.exceptions.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:
      io.micronaut.serde.exceptions.SerdeException