Class BeanValidationUtil


  • public final class BeanValidationUtil
    extends Object
    BeanValidationUtils validates beans using JSR303 annotations.
    See Also:
    validate(Object)
    • Method Detail

      • validate

        public static <T> Set<javax.validation.ConstraintViolation<T>> validate​(T bean)
        Validates a bean.
        Type Parameters:
        T - the bean type
        Parameters:
        bean - the bean to validate
        Returns:
        the sets the
      • getValidator

        public static javax.validation.Validator getValidator()
        Use this in case you need more than a global validation
        Returns:
        the validator
      • validate

        public static <T> List<ValidationError> validate​(T bean,
                                                         Locale locale,
                                                         String strFieldKeysPrefix)
        Validate a bean
        Type Parameters:
        T - The bean class
        Parameters:
        bean - The bean
        locale - The locale
        strFieldKeysPrefix - The fields keys prefix in the resource file
        Returns:
        A list of errors
      • validate

        public static <T> List<ValidationError> validate​(T bean,
                                                         Locale locale,
                                                         ValidationErrorConfig config)
        Validate a bean
        Type Parameters:
        T - The bean class
        Parameters:
        bean - The bean
        locale - The locale
        config - The config for validation errors rendering
        Returns:
        A list of errors