类 DefaultBindingErrorProcessor
java.lang.Object
cn.taketoday.validation.DefaultBindingErrorProcessor
- 所有已实现的接口:
BindingErrorProcessor
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.
- 从以下版本开始:
- 4.0
- 作者:
- Alef Arendsen, Juergen Hoeller
- 另请参阅:
-
MISSING_FIELD_ERROR_CODEDataBinder.setBindingErrorProcessor(cn.taketoday.validation.BindingErrorProcessor)AbstractBindingResult.addError(cn.taketoday.validation.ObjectError)AbstractBindingResult.resolveMessageCodes(java.lang.String)PropertyAccessException.getErrorCode()TypeMismatchException.ERROR_CODEMethodInvocationException.ERROR_CODE
-
字段概要
字段修饰符和类型字段说明static final StringError code that a missing field error (i.e. a required field not found in the list of property values) will be registered with: "required". -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected Object[]getArgumentsForBindError(String objectName, String field) Return FieldError arguments for a binding error on the given field.voidprocessMissingFieldError(String missingField, BindingResult bindingResult) Apply the missing field error to the given BindException.voidprocessPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) Translate the givenPropertyAccessExceptionto an appropriate error registered on the givenErrorsinstance.
-
字段详细资料
-
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
public DefaultBindingErrorProcessor()
-
-
方法详细资料
-
processMissingFieldError
从接口复制的说明:BindingErrorProcessorApply the missing field error to the given BindException.Usually, a field error is created for a missing required field.
- 指定者:
processMissingFieldError在接口中BindingErrorProcessor- 参数:
missingField- the field that was missing during bindingbindingResult- the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. TheBindingResultobject features convenience utils such as aresolveMessageCodesmethod to resolve an error code.- 另请参阅:
-
processPropertyAccessException
从接口复制的说明:BindingErrorProcessorTranslate the givenPropertyAccessExceptionto an appropriate error registered on the givenErrorsinstance.Note that two error types are available:
FieldErrorandObjectError. Usually, field errors are created, but in certain situations one might want to create a globalObjectErrorinstead.- 指定者:
processPropertyAccessException在接口中BindingErrorProcessor- 参数:
ex- thePropertyAccessExceptionto translatebindingResult- the errors object to add the error(s) to. You can add more than just one error or maybe even ignore it. TheBindingResultobject features convenience utils such as aresolveMessageCodesmethod to resolve an error code.- 另请参阅:
-
getArgumentsForBindError
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).
- 参数:
objectName- the name of the target objectfield- the field that caused the binding error- 返回:
- the Object array that represents the FieldError arguments
- 另请参阅:
-