Package org.dellroad.stuff.validation
Class ValidationUtil
java.lang.Object
org.dellroad.stuff.validation.ValidationUtil
Validation utility methods.
-
Method Details
-
validate
public static <T> Set<jakarta.validation.ConstraintViolation<T>> validate(T obj, Class<?>... groups) Validate the given object.This method simply creates a
ValidationContext
with the given root and invokesValidationContext.validate()
.- Type Parameters:
T
- root validation object type- Parameters:
obj
- object to validategroups
- group(s) targeted for validation (if empty, defaults toDefault
)- Returns:
- zero or more violations
- Throws:
IllegalArgumentException
- if either paramter is null
-
describe
Describe the validation errors in a friendly format.- Parameters:
violations
- validation violations- Returns:
- description of the validation errors
- Throws:
NullPointerException
- ifviolations
is null
-