Package org.springframework.validation
Class FieldError
java.lang.Object
org.springframework.context.support.DefaultMessageSourceResolvable
org.springframework.validation.ObjectError
org.springframework.validation.FieldError
- All Implemented Interfaces:
Serializable,MessageSourceResolvable
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:
-
Constructor Summary
ConstructorsConstructorDescriptionFieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure, String[] codes, Object[] arguments, String defaultMessage) Create a new FieldError instance.FieldError(String objectName, String field, String defaultMessage) Create a new FieldError instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetField()Return the affected field of the object.Return the rejected field value.inthashCode()booleanReturn whether this error represents a binding failure (like a type mismatch); otherwise it is a validation failure.toString()The default implementation exposes the attributes of this MessageSourceResolvable.Methods inherited from class org.springframework.validation.ObjectError
contains, getObjectName, unwrap, wrapMethods inherited from class org.springframework.context.support.DefaultMessageSourceResolvable
getArguments, getCode, getCodes, getDefaultMessage, resolvableToString, shouldRenderDefaultMessage
-
Constructor Details
-
FieldError
Create a new FieldError instance.- Parameters:
objectName- the name of the affected objectfield- the affected field of the objectdefaultMessage- the default message to be used to resolve this message
-
FieldError
public FieldError(String objectName, String field, @Nullable Object rejectedValue, boolean bindingFailure, @Nullable String[] codes, @Nullable Object[] arguments, @Nullable String defaultMessage) Create a new FieldError instance.- Parameters:
objectName- the name of the affected objectfield- the affected field of the objectrejectedValue- the rejected field valuebindingFailure- whether this error represents a binding failure (like a type mismatch); else, it is a validation failurecodes- the codes to be used to resolve this messagearguments- the array of arguments to be used to resolve this messagedefaultMessage- the default message to be used to resolve this message
-
-
Method Details
-
getField
Return the affected field of the 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. -
equals
- Overrides:
equalsin classObjectError
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectError
-
toString
Description copied from class:DefaultMessageSourceResolvableThe default implementation exposes the attributes of this MessageSourceResolvable.To be overridden in more specific subclasses, potentially including the resolvable content through
resolvableToString().- Overrides:
toStringin classObjectError- See Also:
-