Class GeneratedSerdeExceptionUtil
java.lang.Object
io.micronaut.serde.util.GeneratedSerdeExceptionUtil
Exception helpers used by generated serdes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SerdeExceptionduplicateProperty(String propertyName, io.micronaut.core.type.Argument<?> beanType) Creates aSerdeExceptionfor a duplicate property and enriches it with the property path.static voidhandleUnknownProperty(Decoder decoder, Deserializer.DecoderContext context, String propertyName, io.micronaut.core.type.Argument<?> beanType) Handles an unknown property according to deserialization configuration.static SerdeExceptionunknownEnumValue(io.micronaut.core.type.Argument<?> enumType, String value) Creates aSerdeExceptionfor an unknown enum value.static SerdeExceptionunknownProperty(String propertyName, io.micronaut.core.type.Argument<?> beanType) Creates aSerdeExceptionfor an unknown property and enriches it with the property path.static SerdeExceptionwithPropertyPath(SerdeException exception, io.micronaut.core.type.Argument<?> beanType, String propertyName, io.micronaut.core.type.Argument<?> propertyArgument) Appends a property path segment to an existingSerdeException.static SerdeExceptionwithPropertyPath(Throwable exception, io.micronaut.core.type.Argument<?> beanType, String propertyName, io.micronaut.core.type.Argument<?> propertyArgument) Converts anyThrowableinto aSerdeExceptionand appends a property path segment.
-
Method Details
-
unknownProperty
public static SerdeException unknownProperty(String propertyName, io.micronaut.core.type.Argument<?> beanType) Creates aSerdeExceptionfor 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 aSerdeExceptionfor 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 aSerdeExceptionfor 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 existingSerdeException.- 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 anyThrowableinto aSerdeExceptionand 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.
-