Class ValidatorImpl

java.lang.Object
com.hotels.transformer.validator.ValidatorImpl
All Implemented Interfaces:
Validator

public class ValidatorImpl
extends Object
implements Validator
Java Bean validation class. It offers the possibility to validate a given Java Bean against a set of defined constraints.
  • Constructor Details

    • ValidatorImpl

      public ValidatorImpl()
      Default constructor.
  • Method Details

    • getConstraintViolations

      public final <K> Set<jakarta.validation.ConstraintViolation<Object>> getConstraintViolations​(K k)
      Checks if an object is valid and returns the list of the constraints not met.
      Specified by:
      getConstraintViolations in interface Validator
      Type Parameters:
      K - the object class
      Parameters:
      k - the object to check
      Returns:
      the list of violated constraints.
    • getConstraintViolationsMessages

      public final <K> List<String> getConstraintViolationsMessages​(K k)
      Checks if an object is valid and returns the list of the constraints messages not met.
      Specified by:
      getConstraintViolationsMessages in interface Validator
      Type Parameters:
      K - the object class
      Parameters:
      k - the object to check
      Returns:
      the list of violated constraints messages.
    • validate

      public final <K> void validate​(K k)
      Checks if an object is valid.
      Specified by:
      validate in interface Validator
      Type Parameters:
      K - the object class
      Parameters:
      k - the object to check