Package dev.relism.flash.ext.jackson
Class Validator
java.lang.Object
dev.relism.flash.ext.jackson.Validator
The compiled constraints of one type. Built once per class and reused for every request.
verify(java.lang.Object) allocates nothing when a value passes: the loop walks an array (no iterator),
reads fields through exact-signature MethodHandles (no boxing, no argument array), and
compares against operands resolved at compile time. The violation list and the exception are
constructed only once something actually fails.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tcheck(T value) Verifies a value against its own type's constraints.booleanisEmpty()True when the type declares no constraints at all —verify(java.lang.Object)is then a no-op.static ValidatorThe constraints oftype, compiled the first time it is seen and reused after.voidVerifies every constraint ontarget.
-
Method Details
-
of
The constraints oftype, compiled the first time it is seen and reused after. -
check
public static <T> T check(T value) Verifies a value against its own type's constraints.- Returns:
value, so it can be used inline- Throws:
ValidationException- 422, listing every failure
-
isEmpty
public boolean isEmpty()True when the type declares no constraints at all —verify(java.lang.Object)is then a no-op. -
verify
Verifies every constraint ontarget.- Throws:
ValidationException- with all failures, never just the first
-