类 FieldError

所有已实现的接口:
MessageSourceResolvable, Serializable

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.

从以下版本开始:
4.0
作者:
Rod Johnson, Juergen Hoeller
另请参阅:
  • 构造器详细资料

    • FieldError

      public FieldError(String objectName, String field, String defaultMessage)
      Create a new FieldError instance.
      参数:
      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(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 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
  • 方法详细资料

    • getField

      public String getField()
      Return the affected field of the object.
    • 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()
      从类复制的说明: DefaultMessageSourceResolvable
      The default implementation exposes the attributes of this MessageSourceResolvable.

      To be overridden in more specific subclasses, potentially including the resolvable content through resolvableToString().

      覆盖:
      toString 在类中 ObjectError
      另请参阅: