Package com.hotels.transformer.validator
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> Set<jakarta.validation.ConstraintViolation<Object>>
getConstraintViolations(K k)
Checks if an object is valid and returns the list of the constraints not met.<K> List<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, 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
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
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:
IllegalArgumentException
- if the object isnull
-
notNull
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:
IllegalArgumentException
- if the object isnull
-