public class

FieldError

extends ObjectError
java.lang.Object
   ↳ org.springframework.context.support.DefaultMessageSourceResolvable
     ↳ org.springframework.validation.ObjectError
       ↳ org.springframework.validation.FieldError

Class Overview

Encapsulates a field error, that is, a reason for rejecting a specific field value.

See the DefaultMessageCodesResolver javadoc for details on how a message code list is built for a FieldError.

Summary

Public Constructors
FieldError(String objectName, String field, String defaultMessage)
Create a new FieldError instance.
FieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure, String[] codes, Object[] arguments, String defaultMessage)
Create a new FieldError instance.
Public Methods
boolean equals(Object other)
String getField()
Return the affected field of the object.
Object getRejectedValue()
Return the rejected field value.
int hashCode()
boolean isBindingFailure()
Return whether this error represents a binding failure (like a type mismatch); otherwise it is a validation failure.
String toString()
Default implementation exposes the attributes of this MessageSourceResolvable.
[Expand]
Inherited Methods
From class org.springframework.validation.ObjectError
From class org.springframework.context.support.DefaultMessageSourceResolvable
From class java.lang.Object
From interface org.springframework.context.MessageSourceResolvable

Public Constructors

public FieldError (String objectName, String field, String defaultMessage)

Create a new FieldError instance.

Parameters
objectName the name of the affected object
field the affected field of the object
defaultMessage the default message to be used to resolve this message

public FieldError (String objectName, String field, Object rejectedValue, boolean bindingFailure, String[] codes, Object[] arguments, String defaultMessage)

Create a new FieldError instance.

Parameters
objectName the name of the affected object
field the affected field of the object
rejectedValue the rejected field value
bindingFailure whether this error represents a binding failure (like a type mismatch); else, it is a validation failure
codes the codes to be used to resolve this message
arguments the array of arguments to be used to resolve this message
defaultMessage the default message to be used to resolve this message

Public Methods

public boolean equals (Object other)

public String getField ()

Return the affected field of the object.

public Object getRejectedValue ()

Return the rejected field value.

public int hashCode ()

public boolean isBindingFailure ()

Return whether this error represents a binding failure (like a type mismatch); otherwise it is a validation failure.

public String toString ()

Default implementation exposes the attributes of this MessageSourceResolvable. To be overridden in more specific subclasses, potentially including the resolvable content through resolvableToString().