Class JSR303ViolationException

All Implemented Interfaces:
Serializable

public class JSR303ViolationException extends AxonNonTransientException
Exception indicating that a Message has been refused due to a structural validation failure. Typically, resending the same message will result in the exact same exception.

Provides a set of JSR303 ConstraintViolations that provide details about the exact failure of the message.

Since:
1.1
Author:
Allard Buijze
See Also:
  • Constructor Details

    • JSR303ViolationException

      public JSR303ViolationException(Set<jakarta.validation.ConstraintViolation<Object>> violations)
      Initializes an exception with the given message and violations.
      Parameters:
      violations - the violations that were detected
  • Method Details

    • getViolations

      public Set<jakarta.validation.ConstraintViolation<Object>> getViolations()
      Returns the violations that were detected when this exception was thrown.
      Returns:
      the violations that were detected when this exception was thrown
    • convert

      protected static String convert(Set<jakarta.validation.ConstraintViolation<Object>> violations)
      Convert the violations to a human readable format, sorted by class and property e.g.:
         property ab in class my.some.Klass may not be null
         property cd in class my.some.OtherClass length must be between 0 and 3
         property cd in class my.some.OtherClass must match "ab.*"
         property notNull in class my.some.TheClass may not be null
       
      Parameters:
      violations - set of violations that were detected when the exception was thrown
      Returns:
      a human-readable string describing the violations