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.
Modifier and Type | Method and Description |
---|---|
Set<ParamError> |
getAllErrors()
Returns an immutable set of all binding and validation errors.
|
List<String> |
getAllMessages()
Returns an immutable list of all messages representing both binding and
validation errors.
|
Set<ParamError> |
getErrors(String param)
Returns an immutable set of all binding and validation errors for
a specific parameter.
|
boolean |
isFailed()
Returns
true if there is at least one parameter error. |
boolean isFailed()
true
if there is at least one parameter error.true
if there is at least one parameter errorList<String> getAllMessages()
getAllErrors().stream().map(ParamError::getMessage).collect(Collectors.toList())
Set<ParamError> getAllErrors()
Set<ParamError> getErrors(String param)
param
- parameter nameCopyright © 2019 Ivar Grimstad. All rights reserved.