Interface Validator
- All Known Implementing Classes:
ValidatorImpl
public interface Validator
Java Bean validation class.
It offers the possibility to validate a given Java Bean against a set of defined constraints.
-
Method Summary
Modifier and Type Method Description <K> java.util.Set<jakarta.validation.ConstraintViolation<java.lang.Object>>
getConstraintViolations(K k)
Checks if an object is valid and returns the list of the constraints not met.<K> java.util.List<java.lang.String>
getConstraintViolationsMessages(K k)
Checks if an object is valid and returns the list of the constraints messages not met.static <T> void
notNull(T object)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
.static <T> void
notNull(T object, java.lang.String message)
Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.<K> void
validate(K k)
Checks if an object is valid.
-
Method Details
-
getConstraintViolations
<K> java.util.Set<jakarta.validation.ConstraintViolation<java.lang.Object>> getConstraintViolations(K k)Checks if an object is valid and returns the list of the constraints not met.- Type Parameters:
K
- the object class- Parameters:
k
- the object to check- Returns:
- the list of violated constraints.
-
getConstraintViolationsMessages
<K> java.util.List<java.lang.String> getConstraintViolationsMessages(K k)Checks if an object is valid and returns the list of the constraints messages not met.- Type Parameters:
K
- the object class- Parameters:
k
- the object to check- Returns:
- the list of violated constraints messages.
-
validate
<K> void validate(K k)Checks if an object is valid.- Type Parameters:
K
- the object class- Parameters:
k
- the object to check- Throws:
InvalidBeanException
-InvalidBeanException
if the validation fails
-
notNull
static <T> void notNull(T object)Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
.- Type Parameters:
T
- the object type- Parameters:
object
- the object to check- Throws:
java.lang.IllegalArgumentException
- if the object isnull
-
notNull
static <T> void notNull(T object, java.lang.String message)Validate that the specified argument is notnull
; otherwise throws anIllegalArgumentException
with the specified message.- Type Parameters:
T
- the object type- Parameters:
object
- the object to checkmessage
- theString.format(String, Object...)
exception message if invalid, not null- Throws:
java.lang.IllegalArgumentException
- if the object isnull
-