Class ValidationUtils


  • public class ValidationUtils
    extends java.lang.Object
    Static methods useful for checking constraint violations with validation framework.
    Since:
    4.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> boolean isValid​(T entity)
      Checks the validity of the given object (entity) against the constraints set by annotation.
      static boolean isValidIdentifier​(java.lang.String input)
      Is input a valid pubserver identifier or not.
      static boolean isValidName​(java.lang.String input)
      Is input a valid pubserver name or not.
      static <T> void validate​(T entity)
      Checks the validity of the given object (entity) against the constraints set by annotation and throw an exception if anything is not valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isValid

        public static <T> boolean isValid​(T entity)
        Checks the validity of the given object (entity) against the constraints set by annotation.

        In case of violation a log may be written - log level debug.

        If you want to interpret the violation details it is recommended to build your own validator instance.

        Parameters:
        entity -
        Returns:
        true if valid
        See Also:
        Validator.validate(Object, Class...)
      • validate

        public static <T> void validate​(T entity)
                                 throws ValidationFailedException
        Checks the validity of the given object (entity) against the constraints set by annotation and throw an exception if anything is not valid.

        Exception message will contain information on the constraints that have been violated.

        Parameters:
        entity -
        Throws:
        ValidationFailedException
        See Also:
        Validator.validate(Object, Class...)
      • isValidIdentifier

        public static boolean isValidIdentifier​(java.lang.String input)
        Is input a valid pubserver identifier or not. See ValidIdentifier.
        Null or empty string is considered invalid.
        Parameters:
        input - String to validate.
      • isValidName

        public static boolean isValidName​(java.lang.String input)
        Is input a valid pubserver name or not. See ValidName.
        Null or empty string is considered invalid.
        Parameters:
        input - String to validate.