Package com.onec.validation
Class ValidationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.onec.validation.ValidationException
- All Implemented Interfaces:
Serializable
Thrown when an entity fails framework validation on the write path — a missing required
attribute, an out-of-range / malformed value, or a failed
BusinessRule.
A distinct typed exception (not a raw IllegalStateException) so the web layer maps it
to a 4xx instead of a 500. It carries both a single getField() (for the simple
one-field case — e.g. a missing required attribute on a public intake repository.save,
issue #32) and the richer fieldErrors() / formErrors() collected by
ValidationErrors, so a form can map every failure onto the right input at once. The UI
starter registers a handler that performs the HTTP mapping; headless apps can catch this
directly.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionValidationException(String message) ValidationException(String message, String field) A single-field (or, whenfieldis null, form-level) failure.Multiple collected failures, keyed by field plus any form-level messages. -
Method Summary
Modifier and TypeMethodDescriptionPer-field messages, keyed by attribute field name, in declaration order.Cross-field / form-level messages not tied to a specific input.getField()Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ValidationException
-
ValidationException
A single-field (or, whenfieldis null, form-level) failure. -
ValidationException
public ValidationException(String message, Map<String, List<String>> fieldErrors, List<String> formErrors) Multiple collected failures, keyed by field plus any form-level messages.
-
-
Method Details
-
getField
-
fieldErrors
Per-field messages, keyed by attribute field name, in declaration order. -
formErrors
Cross-field / form-level messages not tied to a specific input.
-