Package io.permazen
Class ValidationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.permazen.core.DatabaseException
io.permazen.ValidationException
- All Implemented Interfaces:
Serializable
Thrown when
PermazenTransaction.validate()
(or PermazenTransaction.commit()
) fails due to one or more
validation errors.-
Constructor Summary
ConstructorDescriptionValidationException
(PermazenObject pobj, String message) Convenience constructor for use when JSR 303 validation is not involved.ValidationException
(PermazenObject pobj, String message, Throwable cause) Convenience constructor for use when JSR 303 validation is not involved.ValidationException
(PermazenObject pobj, Set<jakarta.validation.ConstraintViolation<PermazenObject>> violations, String message) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet the object that failed to validate.Set<jakarta.validation.ConstraintViolation<PermazenObject>>
Get the validation errors in case validation failed due to a failed JSR 303 validation check.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ValidationException
public ValidationException(PermazenObject pobj, Set<jakarta.validation.ConstraintViolation<PermazenObject>> violations, String message) Constructor.- Parameters:
pobj
- the object that failed validationviolations
- JSR 303 validation errors, if any, otherwise nullmessage
- exception message
-
ValidationException
Convenience constructor for use when JSR 303 validation is not involved.- Parameters:
pobj
- the object that failed validationmessage
- exception message
-
ValidationException
Convenience constructor for use when JSR 303 validation is not involved.- Parameters:
pobj
- the object that failed validationmessage
- exception messagecause
- underlying cause, or null for none
-
-
Method Details
-
getObject
Get the object that failed to validate.- Returns:
- the invalid object
-
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
-