类 FieldError
- java.lang.Object
- org.springframework.context.support.DefaultMessageSourceResolvable
- org.springframework.validation.ObjectError
- org.springframework.validation.FieldError
- 所有已实现的接口:
Serializable,MessageSourceResolvable
public class FieldError extends ObjectError
Encapsulates a field error, that is, a reason for rejecting a specific field value.See the
DefaultMessageCodesResolverjavadoc for details on how a message code list is built for aFieldError.- 从以下版本开始:
- 10.03.2003
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
DefaultMessageCodesResolver, 序列化表格
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(Object other)StringgetField()Return the affected field of the object.ObjectgetRejectedValue()Return the rejected field value.inthashCode()booleanisBindingFailure()Return whether this error represents a binding failure (like a type mismatch); otherwise it is a validation failure.StringtoString()The default implementation exposes the attributes of this MessageSourceResolvable.从类继承的方法 org.springframework.validation.ObjectError
contains, getObjectName, unwrap, wrap
从类继承的方法 org.springframework.context.support.DefaultMessageSourceResolvable
getArguments, getCode, getCodes, getDefaultMessage, resolvableToString, shouldRenderDefaultMessage
构造器详细资料
FieldError
public FieldError(String objectName, String field, String defaultMessage)
Create a new FieldError instance.- 参数:
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.- 参数:
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
方法详细资料
getRejectedValue
@Nullable public 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
public boolean equals(@Nullable Object other)
- 覆盖:
equals在类中ObjectError
hashCode
public int hashCode()
- 覆盖:
hashCode在类中ObjectError
toString
public String toString()
从类复制的说明:DefaultMessageSourceResolvableThe default implementation exposes the attributes of this MessageSourceResolvable.To be overridden in more specific subclasses, potentially including the resolvable content through
resolvableToString().