Class ValidationUtils


  • public final class ValidationUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ValidationUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addDefaultViolationMessage​(javax.validation.ConstraintValidatorContext context, java.lang.String message)
      Add the custom violation message as the error message.
      static void addDefaultViolationMessageToInnerField​(javax.validation.ConstraintValidatorContext context, java.lang.String fieldName)
      Add the default violation message as the error message for a inner field.
      static void addDefaultViolationMessageToInnerField​(javax.validation.ConstraintValidatorContext context, java.lang.String fieldName, java.lang.String message)
      Add the custom violation message as the error message for a inner field.
      static boolean isValidDateFormat​(java.lang.String format, java.lang.String value)
      Validation of date format.
      static boolean isValidUuidString​(java.lang.String string)  
      static boolean matchPattern​(java.lang.String stringPattern, java.lang.String value)  
      static boolean validateUuids​(java.util.Collection<java.lang.String> values)
      Validation of uuids.
      • Methods inherited from class java.lang.Object

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

      • ValidationUtils

        public ValidationUtils()
    • Method Detail

      • isValidUuidString

        public static boolean isValidUuidString​(java.lang.String string)
      • validateUuids

        public static boolean validateUuids​(java.util.Collection<java.lang.String> values)
        Validation of uuids.
        Parameters:
        values - collection of uuids
        Returns:
        true if all strings are valid UUIDs, false otherwise
      • isValidDateFormat

        public static boolean isValidDateFormat​(java.lang.String format,
                                                java.lang.String value)
        Validation of date format.
        Parameters:
        format - is the format of date
        value - is a date value to check
        Returns:
        true if date is valid against given format
      • matchPattern

        public static boolean matchPattern​(java.lang.String stringPattern,
                                           java.lang.String value)
      • addDefaultViolationMessageToInnerField

        public static void addDefaultViolationMessageToInnerField​(javax.validation.ConstraintValidatorContext context,
                                                                  java.lang.String fieldName)
        Add the default violation message as the error message for a inner field.
        Parameters:
        context - is the validation context
        fieldName - is a name of the field inner the object to which the annotation was applied
      • addDefaultViolationMessageToInnerField

        public static void addDefaultViolationMessageToInnerField​(javax.validation.ConstraintValidatorContext context,
                                                                  java.lang.String fieldName,
                                                                  java.lang.String message)
        Add the custom violation message as the error message for a inner field.
        Parameters:
        context - is the validation context
        fieldName - is the name of the field inner the object to which the annotation was applied
        message - is the violation message that will be reported as the error message
      • addDefaultViolationMessage

        public static void addDefaultViolationMessage​(javax.validation.ConstraintValidatorContext context,
                                                      java.lang.String message)
        Add the custom violation message as the error message.
        Parameters:
        context - is the validation context
        message - is the violation message that will be reported as the error message