BindingErrorProcessor implementation.
Uses the "required" error code and the field name to resolve message codes for a missing field error.
Creates a FieldError for each PropertyAccessException
given, using the PropertyAccessException's error code ("typeMismatch",
"methodInvocation") for resolving message codes.
MISSING_FIELD_ERROR_CODE, DataBinder#setBindingErrorProcessor, BeanPropertyBindingResult#addError, BeanPropertyBindingResult#resolveMessageCodes, org.springframework.beans.PropertyAccessException#getErrorCode , org.springframework.beans.TypeMismatchException#ERROR_CODE , org.springframework.beans.MethodInvocationException#ERROR_CODE
| Modifier and Type | Field and Description |
|---|---|
| public static final String | MISSING_FIELD_ERROR_CODE
Error code that a missing field error (i.e. a required field not found in the list of property values) will be registered with: "required". |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Object[] | Returns: the Object array that represents the FieldError argumentsthe name of the target object objectName, String the field that caused the binding error field)Return FieldError arguments for a binding error on the given field. |
| public void | processMissingFieldError(String
the field that was missing during binding missingField, BindingResult the errors object to add the error(s) to.
You can add more than just one error or maybe even ignore it.
The bindingResult)BindingResult object features convenience utils such as
a resolveMessageCodes method to resolve an error code.Implements org. Apply the missing field error to the given BindException. |
| public void | processPropertyAccessException(PropertyAccessException
the ex, BindingResult PropertyAccessException to translatethe errors object to add the error(s) to.
You can add more than just one error or maybe even ignore it.
The bindingResult)BindingResult object features convenience utils such as
a resolveMessageCodes method to resolve an error code.Implements org. Translate the given |
| MISSING_FIELD_ERROR_CODE | back to summary |
|---|---|
| public static final String MISSING_FIELD_ERROR_CODE Error code that a missing field error (i.e. a required field not found in the list of property values) will be registered with: "required". | |
| DefaultBindingErrorProcessor | back to summary |
|---|---|
| public DefaultBindingErrorProcessor() | |
| getArgumentsForBindError | back to summary |
|---|---|
| protected Object[] getArgumentsForBindError(String objectName, String field) Return FieldError arguments for a binding error on the given field. Invoked for each missing required field and each type mismatch. The default implementation returns a single argument indicating the field name (of type DefaultMessageSourceResolvable, with "objectName.field" and "field" as codes).
| |
| processMissingFieldError | back to summary |
|---|---|
| public void processMissingFieldError(String missingField, BindingResult bindingResult) Implements org. Doc from org. Apply the missing field error to the given BindException. Usually, a field error is created for a missing required field.
| |
| processPropertyAccessException | back to summary |
|---|---|
| public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) Implements org. Doc from org. Translate the given Note that two error types are available:
| |