Interface Validator

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Validator
Validator for form beans or request beans.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Locale
    resolveLocale(String acceptLanguage, Collection<Locale> acceptedLocales)
     
    void
    validate(Object bean, String acceptLanguage, Class<?>... groups)
    Validate the bean throwing an exception if the bean fails validation.
  • Method Details

    • validate

      void validate(Object bean, String acceptLanguage, Class<?>... groups) throws ValidationException
      Validate the bean throwing an exception if the bean fails validation.

      Typically the exception will be handled by a specific exception handler returning a 422 or 400 status code and usually a map of field paths to error messages.

      Parameters:
      bean - The bean to validate
      Throws:
      ValidationException
    • resolveLocale

      default Locale resolveLocale(String acceptLanguage, Collection<Locale> acceptedLocales)