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 not null; otherwise throws an IllegalArgumentException.
    static <T> void notNull​(T object, java.lang.String message)
    Validate that the specified argument is not null; otherwise throws an IllegalArgumentException 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 not null; otherwise throws an IllegalArgumentException.
      Type Parameters:
      T - the object type
      Parameters:
      object - the object to check
      Throws:
      java.lang.IllegalArgumentException - if the object is null
    • notNull

      static <T> void notNull​(T object, java.lang.String message)
      Validate that the specified argument is not null; otherwise throws an IllegalArgumentException with the specified message.
      Type Parameters:
      T - the object type
      Parameters:
      object - the object to check
      message - the String.format(String, Object...) exception message if invalid, not null
      Throws:
      java.lang.IllegalArgumentException - if the object is null