org.springframework.validation
Class FieldError

org.springframework.context.support.MessageSourceResolvableImpl
  |
  +--org.springframework.validation.ObjectError
        |
        +--org.springframework.validation.FieldError

public class FieldError
extends ObjectError

Encapsulates a field error, i.e. a reason for rejecting a specific field value.

A field error gets created with a single code but uses 3 codes for message resolution, in the following order:

E.g.: code "typeMismatch", field "age", object name "user":

Thus, this resolution algorithm can be leveraged for example to show specific messages for binding errors like "required" and "typeMismatch":

Author:
Rod Johnson, Juergen Hoeller

Field Summary
 final static StringCODE_SEPARATOR
           

Constructor Summary
FieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure, String code, Object[] args, String defaultMessage)
          Create a new FieldError instance, using a default code.

Method Summary
 StringgetField()
           
 ObjectgetRejectedValue()
           
 booleanisBindingFailure()
           
 StringtoString()
           

Methods inherited from class org.springframework.validation.ObjectError
getObjectName

Methods inherited from class org.springframework.context.support.MessageSourceResolvableImpl
getArguments, getCode, getCodes, getDefaultMessage

Field Detail

CODE_SEPARATOR

public final static String CODE_SEPARATOR
Constructor Detail

FieldError

public FieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure, String code, Object[] args, String defaultMessage)
Create a new FieldError instance, using a default code.
Method Detail

getField

public String getField()

getRejectedValue

public Object getRejectedValue()

isBindingFailure

public boolean isBindingFailure()

toString

public String toString()

Association Links

to Class java.lang.String

to Class java.lang.String