Class ValidatorImpl

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

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

    Constructors
    Constructor Description
    ValidatorImpl()
    Default constructor.
  • 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.
    <K> void validate​(K k)
    Checks if an object is valid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ValidatorImpl

      public ValidatorImpl()
      Default constructor.
  • Method Details

    • getConstraintViolations

      public final <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.
      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> 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.
      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