Package io.permazen

Class ValidationException

All Implemented Interfaces:
Serializable

public class ValidationException extends DatabaseException
Thrown when PermazenTransaction.validate() (or PermazenTransaction.commit()) fails due to one or more validation errors.
See Also:
  • Constructor Details

    • ValidationException

      public ValidationException(PermazenObject pobj, Set<jakarta.validation.ConstraintViolation<PermazenObject>> violations, String message)
      Constructor.
      Parameters:
      pobj - the object that failed validation
      violations - JSR 303 validation errors, if any, otherwise null
      message - exception message
    • ValidationException

      public ValidationException(PermazenObject pobj, String message)
      Convenience constructor for use when JSR 303 validation is not involved.
      Parameters:
      pobj - the object that failed validation
      message - exception message
    • ValidationException

      public ValidationException(PermazenObject pobj, String message, Throwable cause)
      Convenience constructor for use when JSR 303 validation is not involved.
      Parameters:
      pobj - the object that failed validation
      message - exception message
      cause - underlying cause, or null for none
  • Method Details

    • getObject

      public PermazenObject getObject()
      Get the object that failed to validate.
      Returns:
      the invalid object
    • getViolations

      public Set<jakarta.validation.ConstraintViolation<PermazenObject>> getViolations()
      Get the validation errors in case validation failed due to a failed JSR 303 validation check.
      Returns:
      set of JSR 303 validation errors, or null if validation did not fail due to JSR 303 validation