Top Description Methods
javax.mvc.binding

public Interface BindingResult

Imports
java.util.List, .Set

Describes the binding result of all controller fields and controller method parameters which are annotated with a binding annotation like javax.ws.rs.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.

Author
Christian Kaltepoth
Since
1.0

Method Summary

Modifier and TypeMethod and Description
public Set<ParamError>

Returns:

All binding and validation errors.
getAllErrors
()

Returns an immutable set of all binding and validation errors.

public List<String>

Returns:

A list of human-readable messages
getAllMessages
()

Returns an immutable list of all messages representing both binding and validation errors.

public Set<ParamError>

Returns:

All binding and validation errors for the parameter.
getErrors
(String
parameter name
param
)

Returns an immutable set of all binding and validation errors for a specific parameter.

public boolean

Returns:

true if there is at least one parameter error
isFailed
()

Returns true if there is at least one parameter error.

Method Detail

getAllErrorsback to summary
public Set<ParamError> getAllErrors()

Returns an immutable set of all binding and validation errors.

Returns:Set<ParamError>

All binding and validation errors.

getAllMessagesback to summary
public 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:List<String>

A list of human-readable messages

getErrorsback to summary
public Set<ParamError> getErrors(String param)

Returns an immutable set of all binding and validation errors for a specific parameter.

Parameters
param:String

parameter name

Returns:Set<ParamError>

All binding and validation errors for the parameter.

isFailedback to summary
public boolean isFailed()

Returns true if there is at least one parameter error.

Returns:boolean

true if there is at least one parameter error