|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.validation.DefaultBindingErrorProcessor
public class DefaultBindingErrorProcessor
Default 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(org.springframework.validation.BindingErrorProcessor)
,
BindException.addError(org.springframework.validation.ObjectError)
,
BindException.resolveMessageCodes(java.lang.String)
,
ErrorCoded.getErrorCode()
,
TypeMismatchException.ERROR_CODE
,
MethodInvocationException.ERROR_CODE
Field Summary | |
---|---|
static 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". |
Constructor Summary | |
---|---|
DefaultBindingErrorProcessor()
|
Method Summary | |
---|---|
protected Object[] |
getArgumentsForBindError(String objectName,
String field)
Return FieldError arguments for a binding error on the given field. |
void |
processMissingFieldError(String missingField,
BindException errors)
Apply the missing field error to the given BindException. |
void |
processPropertyAccessException(PropertyAccessException ex,
BindException errors)
Translate the given PropertyAccessException to an appropriate
error registered on the given Errors instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MISSING_FIELD_ERROR_CODE
Constructor Detail |
---|
public DefaultBindingErrorProcessor()
Method Detail |
---|
public void processMissingFieldError(String missingField, BindException errors)
BindingErrorProcessor
Usually, a field error is created for a missing required field.
processMissingFieldError
in interface BindingErrorProcessor
missingField
- the field that was missing during bindingerrors
- the errors object to add the error(s) to. You can add more than
just one error or maybe even ignore it.BindException.addError(org.springframework.validation.ObjectError)
,
BindException.resolveMessageCodes(java.lang.String)
public void processPropertyAccessException(PropertyAccessException ex, BindException errors)
BindingErrorProcessor
PropertyAccessException
to an appropriate
error registered on the given Errors
instance.
Note that two error types are available: FieldError
and
ObjectError
. Usually, field errors are created, but in certain
situations one might want to create a global ObjectError
instead.
processPropertyAccessException
in interface BindingErrorProcessor
ex
- the PropertyAccessException
to translateerrors
- the errors object to add the error(s) to. You can add more than
just one error or maybe even ignore it. The BindException
object
features convenience utils such as a MessageCodesResolver
to
resolve an error code into message codes.Errors
,
FieldError
,
ObjectError
,
MessageCodesResolver
,
BindException.addError(org.springframework.validation.ObjectError)
,
BindException.resolveMessageCodes(java.lang.String)
protected Object[] getArgumentsForBindError(String objectName, String field)
Default implementation returns a DefaultMessageSourceResolvable with "objectName.field" and "field" as codes.
field
- the field that caused the binding error
DefaultMessageSourceResolvable.getArguments()
,
DefaultMessageSourceResolvable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |