Errors interface for error registration capabilities,
allowing for a Validator to be applied, and adds
binding-specific analysis and model building.
Serves as result holder for a DataBinder, obtained via
the DataBinder#getBindingResult() method. BindingResult
implementations can also be used directly, for example to invoke
a Validator on it (e.g. as part of a unit test).
DataBinder, Errors, Validator, BeanPropertyBindingResult, DirectFieldBindingResult, MapBindingResult
| Modifier and Type | Field and Description |
|---|---|
| public static final String | MODEL_KEY_PREFIX
Prefix for the name of the BindingResult instance in a model, followed by the object name. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public PropertyEditor | Returns: the registered editor, ornull if nonethe path of the property (name or nested path), or
field, Class<?> null if looking for an editor for all properties of the given typethe type of the property (can be valueType)null if a property
is given but should be specified in any case for consistency checking)Find a custom property editor for the given type and property. |
| public Map | getModel()
Return a model Map for the obtained state, exposing a BindingResult
instance as ' |
| public PropertyEditorRegistry | Returns: the PropertyEditorRegistry, ornull if none
available for this BindingResultReturn the underlying PropertyEditorRegistry. |
| public Object | Returns: the current value of the field in its raw form, ornull if not knownthe field to check field)Extract the raw field value for the given field. |
| public default String[] | |
| public Object | getTarget()
Return the wrapped target object, which may be a bean, an object with public fields, a Map - depending on the concrete binding strategy. |
| public default void | recordFieldValue(String
the field to record the value for field, Class<?> the type of the field type, Object the original value value)Record the given value for the specified field. |
| public default void | |
| public String[] | Returns: the resolved message codesthe error code to resolve into message codes errorCode)Resolve the given error code into message codes. |
| public String[] | Returns: the resolved message codesthe error code to resolve into message codes errorCode, String the field to resolve message codes for field)Resolve the given error code into message codes for the given field. |
| MODEL_KEY_PREFIX | back to summary |
|---|---|
| public static final String MODEL_KEY_PREFIX Prefix for the name of the BindingResult instance in a model, followed by the object name. | |
| addError | back to summary |
|---|---|
| public void addError(ObjectError error) Add a custom Intended to be used by cooperating strategies such as
| |
| findEditor | back to summary |
|---|---|
| public PropertyEditor findEditor(String field, Class<?> valueType) Find a custom property editor for the given type and property.
| |
| getModel | back to summary |
|---|---|
| public Map Return a model Map for the obtained state, exposing a BindingResult
instance as ' Note that the Map is constructed every time you're calling this method. Adding things to the map and then re-calling this method will not work. The attributes in the model Map returned by this method are usually
included in the | |
| getPropertyEditorRegistry | back to summary |
|---|---|
| public PropertyEditorRegistry getPropertyEditorRegistry() Return the underlying PropertyEditorRegistry.
| |
| getRawFieldValue | back to summary |
|---|---|
| public Object getRawFieldValue(String field) Extract the raw field value for the given field. Typically used for comparison purposes. | |
| getSuppressedFields | back to summary |
|---|---|
| public default String[] getSuppressedFields() Return the list of fields that were suppressed during the bind process. Can be used to determine whether any field values were targeting disallowed fields.
| |
| getTarget | back to summary |
|---|---|
| public Object getTarget() Return the wrapped target object, which may be a bean, an object with public fields, a Map - depending on the concrete binding strategy.
| |
| recordFieldValue | back to summary |
|---|---|
| public default void recordFieldValue(String field, Class<?> type, Object value) Record the given value for the specified field. To be used when a target object cannot be constructed, making
the original field values available through | |
| recordSuppressedField | back to summary |
|---|---|
| public default void recordSuppressedField(String field) Mark the specified disallowed field as suppressed. The data binder invokes this for each field value that was detected to target a disallowed field.
| |
| resolveMessageCodes | back to summary |
|---|---|
| public String[] resolveMessageCodes(String errorCode) Resolve the given error code into message codes. Calls the configured | |
| resolveMessageCodes | back to summary |
|---|---|
| public String[] resolveMessageCodes(String errorCode, String field) Resolve the given error code into message codes for the given field. Calls the configured | |