Class GeneratedSerdeExceptionUtil

java.lang.Object
io.micronaut.serde.util.GeneratedSerdeExceptionUtil

@Internal public final class GeneratedSerdeExceptionUtil extends Object
Exception helpers used by generated serdes.
  • Method Details

    • unknownProperty

      public static SerdeException unknownProperty(String propertyName, io.micronaut.core.type.Argument<?> beanType)
      Creates a SerdeException for an unknown property and enriches it with the property path.
      Parameters:
      propertyName - The unknown property name.
      beanType - The declaring bean argument.
      Returns:
      The configured exception.
    • duplicateProperty

      public static SerdeException duplicateProperty(String propertyName, io.micronaut.core.type.Argument<?> beanType)
      Creates a SerdeException for a duplicate property and enriches it with the property path.
      Parameters:
      propertyName - The duplicate property name.
      beanType - The declaring bean argument.
      Returns:
      The configured exception.
    • unknownEnumValue

      public static SerdeException unknownEnumValue(io.micronaut.core.type.Argument<?> enumType, String value)
      Creates a SerdeException for an unknown enum value.
      Parameters:
      enumType - The enum argument being deserialized.
      value - The incoming value that could not be resolved.
      Returns:
      The configured exception.
    • handleUnknownProperty

      public static void handleUnknownProperty(Decoder decoder, Deserializer.DecoderContext context, String propertyName, io.micronaut.core.type.Argument<?> beanType) throws IOException
      Handles an unknown property according to deserialization configuration.
      Parameters:
      decoder - The decoder currently positioned on the unknown value.
      context - The decoder context.
      propertyName - The unknown property name.
      beanType - The declaring bean argument.
      Throws:
      IOException - If skipping the value fails.
    • withPropertyPath

      public static SerdeException withPropertyPath(SerdeException exception, io.micronaut.core.type.Argument<?> beanType, String propertyName, io.micronaut.core.type.Argument<?> propertyArgument)
      Appends a property path segment to an existing SerdeException.
      Parameters:
      exception - The exception to enrich.
      beanType - The declaring bean argument.
      propertyName - The property name.
      propertyArgument - The property argument.
      Returns:
      The same exception instance.
    • withPropertyPath

      public static SerdeException withPropertyPath(Throwable exception, io.micronaut.core.type.Argument<?> beanType, String propertyName, io.micronaut.core.type.Argument<?> propertyArgument)
      Converts any Throwable into a SerdeException and appends a property path segment.
      Parameters:
      exception - The original exception.
      beanType - The declaring bean argument.
      propertyName - The property name.
      propertyArgument - The property argument.
      Returns:
      A serde exception enriched with property path information.