Spring Framework

org.springframework.validation
Class FieldError

java.lang.Object
  extended by org.springframework.context.support.DefaultMessageSourceResolvable
      extended by org.springframework.validation.ObjectError
          extended by org.springframework.validation.FieldError
All Implemented Interfaces:
java.io.Serializable, MessageSourceResolvable

public class FieldError
extends ObjectError

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.

Since:
10.03.2003
Author:
Rod Johnson, Juergen Hoeller
See Also:
DefaultMessageCodesResolver, Serialized Form

Constructor Summary
FieldError(java.lang.String objectName, java.lang.String field, java.lang.Object rejectedValue, boolean bindingFailure, java.lang.String[] codes, java.lang.Object[] arguments, java.lang.String defaultMessage)
          Create a new FieldError instance.
FieldError(java.lang.String objectName, java.lang.String field, java.lang.String defaultMessage)
          Create a new FieldError instance.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.String getField()
          Return the affected field of the object.
 java.lang.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.
 java.lang.String toString()
          Default implementation exposes the attributes of this MessageSourceResolvable.
 
Methods inherited from class org.springframework.validation.ObjectError
getObjectName
 
Methods inherited from class org.springframework.context.support.DefaultMessageSourceResolvable
getArguments, getCode, getCodes, getDefaultMessage, resolvableToString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldError

public FieldError(java.lang.String objectName,
                  java.lang.String field,
                  java.lang.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

FieldError

public FieldError(java.lang.String objectName,
                  java.lang.String field,
                  java.lang.Object rejectedValue,
                  boolean bindingFailure,
                  java.lang.String[] codes,
                  java.lang.Object[] arguments,
                  java.lang.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
Method Detail

getField

public java.lang.String getField()
Return the affected field of the object.


getRejectedValue

public java.lang.Object getRejectedValue()
Return the rejected field value.


isBindingFailure

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


toString

public java.lang.String toString()
Description copied from class: DefaultMessageSourceResolvable
Default implementation exposes the attributes of this MessageSourceResolvable. To be overridden in more specific subclasses, potentially including the resolvable content through resolvableToString().

Overrides:
toString in class ObjectError
See Also:
DefaultMessageSourceResolvable.resolvableToString()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class ObjectError

hashCode

public int hashCode()
Overrides:
hashCode in class ObjectError

Spring Framework