You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add methods in KiwiValidations to validate method arguments. Normally these would go in KiwiPreconditions, but since these will require Jakarta Bean Validation, it seems to make more sense for them to live in KiwiValidations.
Method signatures:
// Validate an argument using the default validation grouppublicstatic <T> voidcheckArgumentValid(Tobject)
publicstatic <T> voidcheckArgumentValid(Tobject, StringerrorMessage)
publicstatic <T> voidcheckArgumentValid(Tobject,
StringerrorMessageTemplate,
Object... errorMessageArgs)
publicstatic <T> voidcheckArgumentValid(Tobject,
Function<Set<ConstraintViolation<T>>, String> errorMessageCreator)
// Validate an argument using custom validation group(s)publicstatic <T> voidcheckArgumentValid(Tobject, Class<?>... groupClasses)
publicstatic <T> voidcheckArgumentValid(Tobject, StringerrorMessage, Class<?>... groupClasses)
// Unfortunately have to collect the args for the template in a list since// you can't have two varargs parameters. It could also be an array but// let's use List. It's pretty easy to do List.of(...)publicstatic <T> voidcheckArgumentValid(Tobject,
StringerrorMessageTemplate,
List<Object> errorMessageArgs,
Class<?>... groupClasses)
publicstatic <T> voidcheckArgumentValid(Tobject,
Function<Set<ConstraintViolation<T>>, String> errorMessageCreator,
Class<?>... groupClasses)
// Check set of constraint violationspublicstatic <T> voidcheckArgumentNoViolations(Set<ConstraintViolation<T>> violations)
publicstatic <T> voidcheckArgumentNoViolations(Set<ConstraintViolation<T>> violations,
StringerrorMessage)
publicstatic <T> voidcheckArgumentNoViolations(Set<ConstraintViolation<T>> violations,
StringerrorMessageTemplate,
Object... errorMessageArgs)
publicstatic <T> voidcheckArgumentNoViolations(Set<ConstraintViolation<T>> violations,
Function<Set<ConstraintViolation<T>>, String> errorMessageCreator)
The text was updated successfully, but these errors were encountered:
* Add methods that validate and throw ConstraintViolationException if
validation fails
* Add methods that are intended to validate method arguments and throw
IllegalArgumentException if validation fails.
* Update javadoc of KiwiPreconditions to mention the argument validation
methods in KiwiValidations
Closes#750Closes#751
* Add methods that validate and throw ConstraintViolationException if
validation fails
* Add methods that are intended to validate method arguments and throw
IllegalArgumentException if validation fails.
* Update javadoc of KiwiPreconditions to mention the argument validation
methods in KiwiValidations
Closes#750Closes#751
Add methods in
KiwiValidations
to validate method arguments. Normally these would go inKiwiPreconditions
, but since these will require Jakarta Bean Validation, it seems to make more sense for them to live inKiwiValidations
.Method signatures:
The text was updated successfully, but these errors were encountered: