Class DefaultJakartaValidator
java.lang.Object
io.fluxzero.sdk.tracking.handling.validation.jakarta.DefaultJakartaValidator
- All Implemented Interfaces:
Validator
- Direct Known Subclasses:
DefaultValidator
Default reflection based Jakarta Validation implementation used by the SDK.
This class lives in the Jakarta implementation package; the public SDK entry point remains
DefaultValidator.
When validation runs while a DeserializingMessage is current, constrained payload methods may declare
parameters resolved by the active Fluxzero ParameterResolvers. Methods whose parameters
cannot be resolved are ignored for that validation run.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a validator that uses the current Fluxzero clock for temporal constraints.protectedDefaultJakartaValidator(jakarta.validation.ClockProvider clockProvider) Creates a validator that obtains its clock from the supplied JakartaClockProvider.protectedDefaultJakartaValidator(Clock clock) Creates a validator that uses the supplied clock for temporal constraints such as@Pastand@Future. -
Method Summary
Modifier and TypeMethodDescriptioncheckParameterValidity(Object target, Executable executable, Object[] arguments) Validates method or constructor arguments against executable parameter constraints.checkReturnValueValidity(Object target, Executable executable, Object returnValue) Validates a method or constructor return value against return value constraints.checkValidity(T object, Class<?>... groups) Validates a bean instance using Jakarta validation annotations.protected static Stringformat(jakarta.validation.ConstraintViolation<?> v, boolean fullPath) format(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations, boolean fullPath) <T> Set<ConstraintViolation<T>> getConstraintViolations(T object, Class<?>... groups) Validates a bean instance and returns raw constraint violations.protected static StringgetPropertyPath(jakarta.validation.ConstraintViolation<?> v, boolean full) booleanhasReturnValueValidation(Executable executable) Returns whether the executable declares return value constraints or cascaded return value validation.protected ValidationExceptionnewValidationException(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations) protected List<ValidationException.ViolationSummary> violationSummaries(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Validator
areParametersValid, assertValid, assertValidParameters, assertValidReturnValue, isValid
-
Constructor Details
-
DefaultJakartaValidator
protected DefaultJakartaValidator()Creates a validator that uses the current Fluxzero clock for temporal constraints. -
DefaultJakartaValidator
Creates a validator that uses the supplied clock for temporal constraints such as@Pastand@Future.- Parameters:
clock- the clock to use while validating temporal constraints
-
DefaultJakartaValidator
protected DefaultJakartaValidator(jakarta.validation.ClockProvider clockProvider) Creates a validator that obtains its clock from the supplied JakartaClockProvider.- Parameters:
clockProvider- provider used for temporal constraints
-
-
Method Details
-
checkValidity
Validates a bean instance using Jakarta validation annotations. If a message is currently being handled, method constraints with parameters are invoked with arguments resolved from the active Fluxzero configuration.- Specified by:
checkValidityin interfaceValidator- Type Parameters:
T- object type- Parameters:
object- the object to validategroups- optional validation groups- Returns:
- an optional validation exception when constraints fail
-
getConstraintViolations
Validates a bean instance and returns raw constraint violations.This method mirrors Jakarta Validator's raw validation style: it returns structured violations and does not suppress exceptions from getter validation after field constraints have failed.
- Specified by:
getConstraintViolationsin interfaceValidator- Type Parameters:
T- object type- Parameters:
object- the object to validategroups- optional validation groups- Returns:
- raw constraint violations, including property paths and descriptors
-
checkParameterValidity
public Optional<ValidationException> checkParameterValidity(@Nullable Object target, Executable executable, Object[] arguments) Validates method or constructor arguments against executable parameter constraints.- Specified by:
checkParameterValidityin interfaceValidator- Parameters:
target- target instance for methods, ornullfor constructors/static methodsexecutable- the method or constructor declaring the constraintsarguments- argument values in declaration order- Returns:
- an optional validation exception when constraints fail
-
hasReturnValueValidation
Returns whether the executable declares return value constraints or cascaded return value validation.- Specified by:
hasReturnValueValidationin interfaceValidator- Parameters:
executable- the executable to inspect- Returns:
truewhen return value validation should run
-
checkReturnValueValidity
public Optional<ValidationException> checkReturnValueValidity(@Nullable Object target, Executable executable, @Nullable Object returnValue) Validates a method or constructor return value against return value constraints.- Specified by:
checkReturnValueValidityin interfaceValidator- Parameters:
target- target instance for methods, ornullfor constructors/static methodsexecutable- the executable that produced the valuereturnValue- returned value- Returns:
- an optional validation exception when constraints fail
-
newValidationException
protected ValidationException newValidationException(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations) -
format
protected SortedSet<String> format(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations, boolean fullPath) -
violationSummaries
protected List<ValidationException.ViolationSummary> violationSummaries(Collection<? extends jakarta.validation.ConstraintViolation<?>> violations) -
format
-
getPropertyPath
-