Package com.jsgalactic.axiom.context
Interface BodyValidator<T>
- Type Parameters:
T- type of value checked
- All Known Subinterfaces:
Validator<T>
- All Known Implementing Classes:
JakartaValidation,Rules
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Checks a decoded request body for
Context.validatedBody(Class, BodyValidator).
The optional axiom-validation module's Validator extends this interface, so
its rule sets and the Jakarta Validation adapter can be passed directly; a lambda works too.
Thread safety and ownership. One instance is typically shared by every request, so implementations must be thread-safe and must not retain the value. Violations are sent to clients: fields and codes must come from developer-defined names, never from the value or any other client input.
-
Method Summary
-
Method Details
-
validate
Checks a value.- Parameters:
value- value to check; never null when called byvalidatedBody, but other callers (such asValidation.require) may pass null- Returns:
- violations, empty when the value is valid; never null and without null elements
(callers fail with
IllegalStateExceptionotherwise)
-