Interface BindingResult


  • public interface BindingResult

    Describes the binding result of all controller fields and controller method parameters which are annotated with a binding annotation like FormParam.

    A binding can fail because of type conversion issues or in case of validation errors. The former can for example happen if the binding annotation is placed on a numeric type but the value cannot be converted to that type. The latter may be caused by constraint violations detected during validation.

    Controller methods which declare a parameter of this type will be executed even if the binding for fields and method parameters fails.

    Since:
    1.0
    Author:
    Christian Kaltepoth, Ivar Grimstad
    • Method Detail

      • isFailed

        boolean isFailed()
        Returns true if there is at least one parameter error.
        Returns:
        true if there is at least one parameter error
      • getAllMessages

        List<String> getAllMessages()
        Returns an immutable list of all messages representing both binding and validation errors. This method is a shortcut for:
         getAllErrors().stream().map(ParamError::getMessage).collect(Collectors.toList())
         
        Returns:
        A list of human-readable messages
      • getAllErrors

        Set<ParamError> getAllErrors()
        Returns an immutable set of all binding and validation errors.
        Returns:
        All binding and validation errors.
      • getErrors

        Set<ParamError> getErrors​(String param)
        Returns an immutable set of all binding and validation errors for a specific parameter.
        Parameters:
        param - parameter name
        Returns:
        All binding and validation errors for the parameter.