Top Description Fields Constructors Methods
org.springframework.web.bind.support

public Class WebExchangeBindException

extends ServerWebInputException
implements BindingResult
Class Inheritance
All Implemented Interfaces
org.springframework.validation.BindingResult, org.springframework.validation.Errors
Annotations
@SuppressWarnings:serial
Imports
java.beans.PropertyEditor, java.util.List, .Locale, .Map, org.springframework.beans.PropertyEditorRegistry, org.springframework.context.MessageSource, org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.validation.BeanPropertyBindingResult, .BindingResult, .Errors, .FieldError, .ObjectError, org.springframework.web.server.ServerWebInputException, org.springframework.web.util.BindErrorUtils

ServerWebInputException subclass that indicates a data binding or validation failure.
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final BindingResult

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addAllErrors(Errors
the Errors instance to merge in
errors
)

Overrides default org.springframework.validation.Errors.addAllErrors.

Add all errors from the given Errors instance to this Errors instance.

public void
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public PropertyEditor
findEditor(String
the path of the property (name or nested path), or null if looking for an editor for all properties of the given type
field
,
Class<T>
the type of the property (can be null if a property is given but should be specified in any case for consistency checking)
valueType
)

Implements org.springframework.validation.BindingResult.findEditor.

Find a custom property editor for the given type and property.

public List<ObjectError>
getAllErrors()

Overrides default org.springframework.validation.Errors.getAllErrors.

Get all errors, both global and field ones.

public final BindingResult
getBindingResult()

Return the BindingResult that this BindException wraps.

public Object[]
getDetailMessageArguments()

Overrides org.springframework.web.ErrorResponseException.getDetailMessageArguments.

Overrides default org.springframework.web.ErrorResponse.getDetailMessageArguments.

Return arguments to use along with a message code to resolve the problem "detail" for this exception through a MessageSource.

public Object[]
getDetailMessageArguments(MessageSource
the MessageSource to use for the lookup
source
,
Locale
the Locale to use for the lookup
locale
)

Overrides default org.springframework.web.ErrorResponse.getDetailMessageArguments.

Variant of getDetailMessageArguments() that uses the given MessageSource for resolving the message argument values.

public int
getErrorCount()

Overrides default org.springframework.validation.Errors.getErrorCount.

Determine the total number of errors.

public FieldError
getFieldError()

Overrides default org.springframework.validation.Errors.getFieldError.

Get the first error associated with a field, if any.

public FieldError
getFieldError(String
the field name
field
)

Overrides default org.springframework.validation.Errors.getFieldError.

Get the first error associated with the given field, if any.

public int
getFieldErrorCount()

Overrides default org.springframework.validation.Errors.getFieldErrorCount.

Determine the number of errors associated with a field.

public int
getFieldErrorCount(String
the field name
field
)

Overrides default org.springframework.validation.Errors.getFieldErrorCount.

Determine the number of errors associated with the given field.

public List<FieldError>
getFieldErrors()

Implements org.springframework.validation.Errors.getFieldErrors.

Get all errors associated with a field.

public List<FieldError>
getFieldErrors(String
the field name
field
)

Overrides default org.springframework.validation.Errors.getFieldErrors.

Get all errors associated with the given field.

public Class<?>
getFieldType(String
the field name
field
)

Overrides default org.springframework.validation.Errors.getFieldType.

Determine the type of the given field, as far as possible.

public Object
getFieldValue(String
the field name
field
)

Implements org.springframework.validation.Errors.getFieldValue.

Return the current value of the given field, either the current bean property value or a rejected update from the last binding.

public ObjectError
getGlobalError()

Overrides default org.springframework.validation.Errors.getGlobalError.

Get the first global error, if any.

public int
getGlobalErrorCount()

Overrides default org.springframework.validation.Errors.getGlobalErrorCount.

Determine the number of global errors.

public List<ObjectError>
public String
getMessage()

Overrides org.springframework.web.server.ResponseStatusException.getMessage.

Returns diagnostic information about the errors held in this object.

public Map<String, Object>
getModel()

Implements org.springframework.validation.BindingResult.getModel.

Return a model Map for the obtained state, exposing a BindingResult instance as 'MODEL_KEY_PREFIX + objectName' and the object itself as 'objectName'.

public String
getNestedPath()

Overrides default org.springframework.validation.Errors.getNestedPath.

Return the current nested path of this Errors object.

public String
getObjectName()

Implements org.springframework.validation.Errors.getObjectName.

Return the name of the bound root object.

public PropertyEditorRegistry
public Object
getRawFieldValue(String
the field to check
field
)

Implements org.springframework.validation.BindingResult.getRawFieldValue.

Extract the raw field value for the given field.

public String[]
getSuppressedFields()

Overrides default org.springframework.validation.BindingResult.getSuppressedFields.

Return the list of fields that were suppressed during the bind process.

public Object
getTarget()

Implements org.springframework.validation.BindingResult.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 boolean
hasErrors()

Overrides default org.springframework.validation.Errors.hasErrors.

Determine if there were any errors.

public boolean
hasFieldErrors()

Overrides default org.springframework.validation.Errors.hasFieldErrors.

Determine if there were any errors associated with a field.

public boolean
hasFieldErrors(String
the field name
field
)

Overrides default org.springframework.validation.Errors.hasFieldErrors.

Determine if there were any errors associated with the given field.

public boolean
hasGlobalErrors()

Overrides default org.springframework.validation.Errors.hasGlobalErrors.

Determine if there were any global errors.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
popNestedPath()

Overrides default org.springframework.validation.Errors.popNestedPath.

Pop the former nested path from the nested path stack.

public void
pushNestedPath(String
the sub path to push onto the nested path stack
subPath
)

Overrides default org.springframework.validation.Errors.pushNestedPath.

Push the given sub path onto the nested path stack.

public void
recordFieldValue(String
the field to record the value for
field
,
Class<?>
the type of the field
type
,
Object
the original value
value
)

Overrides default org.springframework.validation.BindingResult.recordFieldValue.

Record the given value for the specified field.

public void
recordSuppressedField(String field)

Overrides default org.springframework.validation.BindingResult.recordSuppressedField.

Mark the specified disallowed field as suppressed.

public void
reject(String
error code, interpretable as a message key
errorCode
)

Overrides default org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

public void
reject(String
error code, interpretable as a message key
errorCode
,
String
fallback default message
defaultMessage
)

Overrides default org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

public void
reject(String
error code, interpretable as a message key
errorCode
,
Object[]
error arguments, for argument binding via MessageFormat (can be null)
errorArgs
,
String
fallback default message
defaultMessage
)

Implements org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

public void
rejectValue(String
the field name (may be null or empty String)
field
,
String
error code, interpretable as a message key
errorCode
)

Overrides default org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

public void
rejectValue(String
the field name (may be null or empty String)
field
,
String
error code, interpretable as a message key
errorCode
,
String
fallback default message
defaultMessage
)

Overrides default org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

public void
rejectValue(String
the field name (may be null or empty String)
field
,
String
error code, interpretable as a message key
errorCode
,
Object[]
error arguments, for argument binding via MessageFormat (can be null)
errorArgs
,
String
fallback default message
defaultMessage
)

Implements org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

public Map<ObjectError, String>

Returns:

a Map with errors as key and resolves messages as value
resolveErrorMessages
(MessageSource messageSource, Locale locale)
Deprecated for removal since 6.1. in favor of using BindErrorUtils and getAllErrors(), to be removed in 6.2

Resolve global and field errors to messages with the given MessageSource and Locale.

public String[]
resolveMessageCodes(String
the error code to resolve into message codes
errorCode
)

Implements org.springframework.validation.BindingResult.resolveMessageCodes.

Resolve the given error code into message codes.

public String[]
resolveMessageCodes(String
the error code to resolve into message codes
errorCode
,
String
the field to resolve message codes for
field
)

Implements org.springframework.validation.BindingResult.resolveMessageCodes.

Resolve the given error code into message codes for the given field.

public void
setNestedPath(String
nested path within this object, e.g. "address" (defaults to "", null is also acceptable). Can end with a dot: both "address" and "address." are valid.
nestedPath
)

Overrides default org.springframework.validation.Errors.setNestedPath.

Allow context to be changed so that standard validators can validate subtrees.

Inherited from org.springframework.web.server.ServerWebInputException:
getMethodParameter

Field Detail

bindingResultback to summary
private final BindingResult bindingResult

Constructor Detail

WebExchangeBindExceptionback to summary
public WebExchangeBindException(MethodParameter parameter, BindingResult bindingResult)

Method Detail

addAllErrorsback to summary
public void addAllErrors(Errors errors)

Overrides default org.springframework.validation.Errors.addAllErrors.

Doc from org.springframework.validation.Errors.addAllErrors.

Add all errors from the given Errors instance to this Errors instance.

This is a convenience method to avoid repeated reject(..) calls for merging an Errors instance into another Errors instance.

Note that the passed-in Errors instance is supposed to refer to the same target object, or at least contain compatible errors that apply to the target object of this Errors instance.

The default implementation throws UnsupportedOperationException since not all Errors implementations support #addAllErrors.

Parameters
errors:Errors

the Errors instance to merge in

Annotations
@Override
addErrorback to summary
public void addError(ObjectError error)

Implements org.springframework.validation.BindingResult.addError.

Doc from org.springframework.validation.BindingResult.addError.

Add a custom ObjectError or FieldError to the errors list.

Intended to be used by cooperating strategies such as BindingErrorProcessor.

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
findEditorback to summary
public PropertyEditor findEditor(String field, Class<T> valueType)

Implements org.springframework.validation.BindingResult.findEditor.

Doc from org.springframework.validation.BindingResult.findEditor.

Find a custom property editor for the given type and property.

Parameters
field:String

the path of the property (name or nested path), or null if looking for an editor for all properties of the given type

valueType:Class<T>

the type of the property (can be null if a property is given but should be specified in any case for consistency checking)

Returns:PropertyEditor

the registered editor, or null if none

Annotations
@Override
@SuppressWarnings:rawtypes
@Nullable
getAllErrorsback to summary
public List<ObjectError> getAllErrors()

Overrides default org.springframework.validation.Errors.getAllErrors.

Doc from org.springframework.validation.Errors.getAllErrors.

Get all errors, both global and field ones.

Returns:List<ObjectError>

a list of ObjectError/FieldError instances

Annotations
@Override
getBindingResultback to summary
public final BindingResult getBindingResult()

Return the BindingResult that this BindException wraps.

Will typically be a BeanPropertyBindingResult.

See Also
BeanPropertyBindingResult
getDetailMessageArgumentsback to summary
public Object[] getDetailMessageArguments()

Overrides org.springframework.web.ErrorResponseException.getDetailMessageArguments.

Overrides default org.springframework.web.ErrorResponse.getDetailMessageArguments.

Doc from org.springframework.web.ErrorResponse.getDetailMessageArguments.

Return arguments to use along with a message code to resolve the problem "detail" for this exception through a MessageSource. The arguments are expanded into placeholders of the message value, e.g. "Invalid content type {0}".

Annotations
@Override
getDetailMessageArgumentsback to summary
public Object[] getDetailMessageArguments(MessageSource source, Locale locale)

Overrides default org.springframework.web.ErrorResponse.getDetailMessageArguments.

Doc from org.springframework.web.ErrorResponse.getDetailMessageArguments.

Variant of getDetailMessageArguments() that uses the given MessageSource for resolving the message argument values.

This is useful for example to expand message codes from validation errors.

The default implementation delegates to getDetailMessageArguments(), ignoring the supplied MessageSource and Locale.

Parameters
source:MessageSource

the MessageSource to use for the lookup

locale:Locale

the Locale to use for the lookup

Annotations
@Override
getErrorCountback to summary
public int getErrorCount()

Overrides default org.springframework.validation.Errors.getErrorCount.

Doc from org.springframework.validation.Errors.getErrorCount.

Determine the total number of errors.

Annotations
@Override
getFieldErrorback to summary
public FieldError getFieldError()

Overrides default org.springframework.validation.Errors.getFieldError.

Doc from org.springframework.validation.Errors.getFieldError.

Get the first error associated with a field, if any.

Returns:FieldError

the field-specific error, or null

Annotations
@Override
@Nullable
getFieldErrorback to summary
public FieldError getFieldError(String field)

Overrides default org.springframework.validation.Errors.getFieldError.

Doc from org.springframework.validation.Errors.getFieldError.

Get the first error associated with the given field, if any.

Parameters
field:String

the field name

Returns:FieldError

the field-specific error, or null

Annotations
@Override
@Nullable
getFieldErrorCountback to summary
public int getFieldErrorCount()

Overrides default org.springframework.validation.Errors.getFieldErrorCount.

Doc from org.springframework.validation.Errors.getFieldErrorCount.

Determine the number of errors associated with a field.

Annotations
@Override
getFieldErrorCountback to summary
public int getFieldErrorCount(String field)

Overrides default org.springframework.validation.Errors.getFieldErrorCount.

Doc from org.springframework.validation.Errors.getFieldErrorCount.

Determine the number of errors associated with the given field.

Parameters
field:String

the field name

Annotations
@Override
getFieldErrorsback to summary
public List<FieldError> getFieldErrors()

Implements org.springframework.validation.Errors.getFieldErrors.

Doc from org.springframework.validation.Errors.getFieldErrors.

Get all errors associated with a field.

Returns:List<FieldError>

a List of FieldError instances

Annotations
@Override
getFieldErrorsback to summary
public List<FieldError> getFieldErrors(String field)

Overrides default org.springframework.validation.Errors.getFieldErrors.

Doc from org.springframework.validation.Errors.getFieldErrors.

Get all errors associated with the given field.

Implementations may support not only full field names like "address.street" but also pattern matches like "address.*".

Parameters
field:String

the field name

Returns:List<FieldError>

a List of FieldError instances

Annotations
@Override
getFieldTypeback to summary
public Class<?> getFieldType(String field)

Overrides default org.springframework.validation.Errors.getFieldType.

Doc from org.springframework.validation.Errors.getFieldType.

Determine the type of the given field, as far as possible.

Implementations should be able to determine the type even when the field value is null, for example from some associated descriptor.

Parameters
field:String

the field name

Returns:Class<?>

the type of the field, or null if not determinable

Annotations
@Override
@Nullable
getFieldValueback to summary
public Object getFieldValue(String field)

Implements org.springframework.validation.Errors.getFieldValue.

Doc from org.springframework.validation.Errors.getFieldValue.

Return the current value of the given field, either the current bean property value or a rejected update from the last binding.

Allows for convenient access to user-specified field values, even if there were type mismatches.

Parameters
field:String

the field name

Returns:Object

the current value of the given field

Annotations
@Override
@Nullable
getGlobalErrorback to summary
public ObjectError getGlobalError()

Overrides default org.springframework.validation.Errors.getGlobalError.

Doc from org.springframework.validation.Errors.getGlobalError.

Get the first global error, if any.

Returns:ObjectError

the global error, or null

Annotations
@Override
@Nullable
getGlobalErrorCountback to summary
public int getGlobalErrorCount()

Overrides default org.springframework.validation.Errors.getGlobalErrorCount.

Doc from org.springframework.validation.Errors.getGlobalErrorCount.

Determine the number of global errors.

Annotations
@Override
getGlobalErrorsback to summary
public List<ObjectError> getGlobalErrors()

Implements org.springframework.validation.Errors.getGlobalErrors.

Doc from org.springframework.validation.Errors.getGlobalErrors.

Get all global errors.

Returns:List<ObjectError>

a list of ObjectError instances

Annotations
@Override
getMessageback to summary
public String getMessage()

Overrides org.springframework.web.server.ResponseStatusException.getMessage.

Returns diagnostic information about the errors held in this object.

Returns:String

Doc from java.lang.Throwable.getMessage.

the detail message string of this Throwable instance (which may be null).

Annotations
@Override
getModelback to summary
public Map<String, Object> getModel()

Implements org.springframework.validation.BindingResult.getModel.

Doc from org.springframework.validation.BindingResult.getModel.

Return a model Map for the obtained state, exposing a BindingResult instance as 'MODEL_KEY_PREFIX + objectName' and the object itself as 'objectName'.

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 org.springframework.web.servlet.ModelAndView for a form view that uses Spring's bind tag in a JSP, which needs access to the BindingResult instance. Spring's pre-built form controllers will do this for you when rendering a form view. When building the ModelAndView instance yourself, you need to include the attributes from the model Map returned by this method.

Annotations
@Override
getNestedPathback to summary
public String getNestedPath()

Overrides default org.springframework.validation.Errors.getNestedPath.

Doc from org.springframework.validation.Errors.getNestedPath.

Return the current nested path of this Errors object.

Returns a nested path with a dot, i.e. "address.", for easy building of concatenated paths. Default is an empty String.

Annotations
@Override
getObjectNameback to summary
public String getObjectName()

Implements org.springframework.validation.Errors.getObjectName.

Doc from org.springframework.validation.Errors.getObjectName.

Return the name of the bound root object.

Annotations
@Override
getPropertyEditorRegistryback to summary
public PropertyEditorRegistry getPropertyEditorRegistry()

Implements org.springframework.validation.BindingResult.getPropertyEditorRegistry.

Doc from org.springframework.validation.BindingResult.getPropertyEditorRegistry.

Return the underlying PropertyEditorRegistry.

Returns:PropertyEditorRegistry

the PropertyEditorRegistry, or null if none available for this BindingResult

Annotations
@Override
@Nullable
getRawFieldValueback to summary
public Object getRawFieldValue(String field)

Implements org.springframework.validation.BindingResult.getRawFieldValue.

Doc from org.springframework.validation.BindingResult.getRawFieldValue.

Extract the raw field value for the given field. Typically used for comparison purposes.

Parameters
field:String

the field to check

Returns:Object

the current value of the field in its raw form, or null if not known

Annotations
@Override
@Nullable
getSuppressedFieldsback to summary
public String[] getSuppressedFields()

Overrides default org.springframework.validation.BindingResult.getSuppressedFields.

Doc from org.springframework.validation.BindingResult.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.

Annotations
@Override
getTargetback to summary
public Object getTarget()

Implements org.springframework.validation.BindingResult.getTarget.

Doc from org.springframework.validation.BindingResult.getTarget.

Return the wrapped target object, which may be a bean, an object with public fields, a Map - depending on the concrete binding strategy.

Annotations
@Override
@Nullable
hasErrorsback to summary
public boolean hasErrors()

Overrides default org.springframework.validation.Errors.hasErrors.

Doc from org.springframework.validation.Errors.hasErrors.

Determine if there were any errors.

Annotations
@Override
hasFieldErrorsback to summary
public boolean hasFieldErrors()

Overrides default org.springframework.validation.Errors.hasFieldErrors.

Doc from org.springframework.validation.Errors.hasFieldErrors.

Determine if there were any errors associated with a field.

Annotations
@Override
hasFieldErrorsback to summary
public boolean hasFieldErrors(String field)

Overrides default org.springframework.validation.Errors.hasFieldErrors.

Doc from org.springframework.validation.Errors.hasFieldErrors.

Determine if there were any errors associated with the given field.

Parameters
field:String

the field name

Annotations
@Override
hasGlobalErrorsback to summary
public boolean hasGlobalErrors()

Overrides default org.springframework.validation.Errors.hasGlobalErrors.

Doc from org.springframework.validation.Errors.hasGlobalErrors.

Determine if there were any global errors.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
popNestedPathback to summary
public void popNestedPath() throws IllegalStateException

Overrides default org.springframework.validation.Errors.popNestedPath.

Doc from org.springframework.validation.Errors.popNestedPath.

Pop the former nested path from the nested path stack.

Annotations
@Override
Exceptions
IllegalStateException:
if there is no former nested path on the stack
pushNestedPathback to summary
public void pushNestedPath(String subPath)

Overrides default org.springframework.validation.Errors.pushNestedPath.

Doc from org.springframework.validation.Errors.pushNestedPath.

Push the given sub path onto the nested path stack.

A popNestedPath() call will reset the original nested path before the corresponding pushNestedPath(String) call.

Using the nested path stack allows to set temporary nested paths for subobjects without having to worry about a temporary path holder.

For example: current path "spouse.", pushNestedPath("child") → result path "spouse.child."; popNestedPath() → "spouse." again.

The default implementation throws UnsupportedOperationException since not all Errors implementations support nested paths.

Parameters
subPath:String

the sub path to push onto the nested path stack

Annotations
@Override
recordFieldValueback to summary
public void recordFieldValue(String field, Class<?> type, Object value)

Overrides default org.springframework.validation.BindingResult.recordFieldValue.

Doc from org.springframework.validation.BindingResult.recordFieldValue.

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 getFieldValue. In case of a registered error, the rejected value will be exposed for each affected field.

Parameters
field:String

the field to record the value for

type:Class<?>

the type of the field

value:Object

the original value

Annotations
@Override
recordSuppressedFieldback to summary
public void recordSuppressedField(String field)

Overrides default org.springframework.validation.BindingResult.recordSuppressedField.

Doc from org.springframework.validation.BindingResult.recordSuppressedField.

Mark the specified disallowed field as suppressed.

The data binder invokes this for each field value that was detected to target a disallowed field.

Annotations
@Override
rejectback to summary
public void reject(String errorCode)

Overrides default org.springframework.validation.Errors.reject.

Doc from org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

Parameters
errorCode:String

error code, interpretable as a message key

Annotations
@Override
rejectback to summary
public void reject(String errorCode, String defaultMessage)

Overrides default org.springframework.validation.Errors.reject.

Doc from org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

Parameters
errorCode:String

error code, interpretable as a message key

defaultMessage:String

fallback default message

Annotations
@Override
rejectback to summary
public void reject(String errorCode, Object[] errorArgs, String defaultMessage)

Implements org.springframework.validation.Errors.reject.

Doc from org.springframework.validation.Errors.reject.

Register a global error for the entire target object, using the given error description.

Parameters
errorCode:String

error code, interpretable as a message key

errorArgs:Object[]

error arguments, for argument binding via MessageFormat (can be null)

defaultMessage:String

fallback default message

Annotations
@Override
rejectValueback to summary
public void rejectValue(String field, String errorCode)

Overrides default org.springframework.validation.Errors.rejectValue.

Doc from org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

The field name may be null or empty String to indicate the current object itself rather than a field of it. This may result in a corresponding field error within the nested object graph or a global error if the current object is the top object.

Parameters
field:String

the field name (may be null or empty String)

errorCode:String

error code, interpretable as a message key

Annotations
@Override
rejectValueback to summary
public void rejectValue(String field, String errorCode, String defaultMessage)

Overrides default org.springframework.validation.Errors.rejectValue.

Doc from org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

The field name may be null or empty String to indicate the current object itself rather than a field of it. This may result in a corresponding field error within the nested object graph or a global error if the current object is the top object.

Parameters
field:String

the field name (may be null or empty String)

errorCode:String

error code, interpretable as a message key

defaultMessage:String

fallback default message

Annotations
@Override
rejectValueback to summary
public void rejectValue(String field, String errorCode, Object[] errorArgs, String defaultMessage)

Implements org.springframework.validation.Errors.rejectValue.

Doc from org.springframework.validation.Errors.rejectValue.

Register a field error for the specified field of the current object (respecting the current nested path, if any), using the given error description.

The field name may be null or empty String to indicate the current object itself rather than a field of it. This may result in a corresponding field error within the nested object graph or a global error if the current object is the top object.

Parameters
field:String

the field name (may be null or empty String)

errorCode:String

error code, interpretable as a message key

errorArgs:Object[]

error arguments, for argument binding via MessageFormat (can be null)

defaultMessage:String

fallback default message

Annotations
@Override
resolveErrorMessagesback to summary
public Map<ObjectError, String> resolveErrorMessages(MessageSource messageSource, Locale locale)

Deprecated

for removal since 6.1.

in favor of using BindErrorUtils and getAllErrors(), to be removed in 6.2

Resolve global and field errors to messages with the given MessageSource and Locale.

Returns:Map<ObjectError, String>

a Map with errors as key and resolves messages as value

Annotations
@Deprecated
since:6.1
forRemoval:true
Since
6.0.3
resolveMessageCodesback to summary
public String[] resolveMessageCodes(String errorCode)

Implements org.springframework.validation.BindingResult.resolveMessageCodes.

Doc from org.springframework.validation.BindingResult.resolveMessageCodes.

Resolve the given error code into message codes.

Calls the configured MessageCodesResolver with appropriate parameters.

Parameters
errorCode:String

the error code to resolve into message codes

Returns:String[]

the resolved message codes

Annotations
@Override
resolveMessageCodesback to summary
public String[] resolveMessageCodes(String errorCode, String field)

Implements org.springframework.validation.BindingResult.resolveMessageCodes.

Doc from org.springframework.validation.BindingResult.resolveMessageCodes.

Resolve the given error code into message codes for the given field.

Calls the configured MessageCodesResolver with appropriate parameters.

Parameters
errorCode:String

the error code to resolve into message codes

field:String

the field to resolve message codes for

Returns:String[]

the resolved message codes

Annotations
@Override
setNestedPathback to summary
public void setNestedPath(String nestedPath)

Overrides default org.springframework.validation.Errors.setNestedPath.

Doc from org.springframework.validation.Errors.setNestedPath.

Allow context to be changed so that standard validators can validate subtrees. Reject calls prepend the given path to the field names.

For example, an address validator could validate the subobject "address" of a customer object.

The default implementation throws UnsupportedOperationException since not all Errors implementations support nested paths.

Parameters
nestedPath:String

nested path within this object, e.g. "address" (defaults to "", null is also acceptable). Can end with a dot: both "address" and "address." are valid.

Annotations
@Override