org.springframework.validation

## 类 AbstractPropertyBindingResult

- java.lang.Object
- - org.springframework.validation.AbstractErrors
  - - org.springframework.validation.AbstractBindingResult
    - - org.springframework.validation.AbstractPropertyBindingResult

- 所有已实现的接口:
    Serializable, BindingResult, Errors
  直接已知子类:
    BeanPropertyBindingResult, DirectFieldBindingResult

      public abstract class AbstractPropertyBindingResult
      extends AbstractBindingResult

  Abstract base class for `BindingResult` implementations that work with Spring's `PropertyAccessor` mechanism. Pre-implements field access through delegation to the corresponding PropertyAccessor methods.
  从以下版本开始:
    2.0
  作者:
    Juergen Hoeller
  另请参阅:
    `getPropertyAccessor()`, `PropertyAccessor`, `ConfigurablePropertyAccessor`, 序列化表格

- - ### 字段概要

    - ### 从接口继承的字段 org.springframework.validation.BindingResult

      `MODEL_KEY_PREFIX`

    - ### 从接口继承的字段 org.springframework.validation.Errors

      `NESTED_PATH_SEPARATOR`

  - ### 构造器概要

    构造器
    限定符 | 构造器和说明
    --- | ---
    `protected` | `AbstractPropertyBindingResult(String objectName)` Create a new AbstractPropertyBindingResult instance.

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected String` | `canonicalFieldName(String field)` Returns the canonical property name.
    `PropertyEditor` | `findEditor(String field, Class<?> valueType)` This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.
    `protected Object` | `formatFieldValue(String field, Object value)` Formats the field value based on registered PropertyEditors.
    `protected Object` | `getActualFieldValue(String field)` Fetches the field value from the PropertyAccessor.
    `protected PropertyEditor` | `getCustomEditor(String fixedField)` Retrieve the custom PropertyEditor for the given field, if any.
    `Class<?>` | `getFieldType(String field)` Determines the field type from the property type.
    `abstract org.springframework.beans.ConfigurablePropertyAccessor` | `getPropertyAccessor()` Provide the PropertyAccessor to work with, according to the concrete strategy of access.
    `org.springframework.beans.PropertyEditorRegistry` | `getPropertyEditorRegistry()` Returns the underlying PropertyAccessor.
    `void` | `initConversion(org.springframework.core.convert.ConversionService conversionService)`

    - ### 从类继承的方法 org.springframework.validation.AbstractBindingResult

      `addAllErrors, addError, equals, getAllErrors, getErrorCount, getFieldError, getFieldError, getFieldErrors, getFieldErrors, getFieldValue, getGlobalError, getGlobalErrors, getMessageCodesResolver, getModel, getObjectName, getRawFieldValue, getSuppressedFields, getTarget, hasErrors, hashCode, recordFieldValue, recordSuppressedField, reject, rejectValue, resolveMessageCodes, resolveMessageCodes, setMessageCodesResolver`

    - ### 从类继承的方法 org.springframework.validation.AbstractErrors

      `doSetNestedPath, fixedField, getFieldErrorCount, getFieldErrorCount, getGlobalErrorCount, getNestedPath, hasFieldErrors, hasFieldErrors, hasGlobalErrors, isMatchingFieldError, popNestedPath, pushNestedPath, reject, reject, rejectValue, rejectValue, setNestedPath, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### 从接口继承的方法 org.springframework.validation.Errors

      `getFieldErrorCount, getFieldErrorCount, getGlobalErrorCount, getNestedPath, hasFieldErrors, hasFieldErrors, hasGlobalErrors, popNestedPath, pushNestedPath, reject, reject, rejectValue, rejectValue, setNestedPath`

- - ### 构造器详细资料

    - #### AbstractPropertyBindingResult

          protected AbstractPropertyBindingResult(String objectName)

      Create a new AbstractPropertyBindingResult instance.
      参数:
        `objectName` - the name of the target object
      另请参阅:
        `DefaultMessageCodesResolver`

  - ### 方法详细资料

    - #### initConversion

          public void initConversion(org.springframework.core.convert.ConversionService conversionService)

    - #### getPropertyEditorRegistry

          public org.springframework.beans.PropertyEditorRegistry getPropertyEditorRegistry()

      Returns the underlying PropertyAccessor.
      指定者:
        `getPropertyEditorRegistry` 在接口中 `BindingResult`
      覆盖:
        `getPropertyEditorRegistry` 在类中 `AbstractBindingResult`
      返回:
        the PropertyEditorRegistry, or `null` if none available for this BindingResult
      另请参阅:
        `getPropertyAccessor()`

    - #### canonicalFieldName

          protected String canonicalFieldName(String field)

      Returns the canonical property name.
      覆盖:
        `canonicalFieldName` 在类中 `AbstractErrors`
      参数:
        `field` - the original field name
      返回:
        the canonical field name
      另请参阅:
        `PropertyAccessorUtils.canonicalPropertyName(java.lang.String)`

    - #### getFieldType

          @Nullable
          public Class<?> getFieldType(@Nullable
                                                  String field)

      Determines the field type from the property type.
      指定者:
        `getFieldType` 在接口中 `Errors`
      覆盖:
        `getFieldType` 在类中 `AbstractBindingResult`
      参数:
        `field` - the field name
      返回:
        the type of the field, or `null` if not determinable
      另请参阅:
        `getPropertyAccessor()`

    - #### getActualFieldValue

          @Nullable
          protected Object getActualFieldValue(String field)

      Fetches the field value from the PropertyAccessor.
      指定者:
        `getActualFieldValue` 在类中 `AbstractBindingResult`
      参数:
        `field` - the field to check
      返回:
        the current value of the field
      另请参阅:
        `getPropertyAccessor()`

    - #### formatFieldValue

          protected Object formatFieldValue(String field,
                                            @Nullable
                                            Object value)

      Formats the field value based on registered PropertyEditors.
      覆盖:
        `formatFieldValue` 在类中 `AbstractBindingResult`
      参数:
        `field` - the field to check
        `value` - the value of the field (either a rejected value other than from a binding error, or an actual field value)
      返回:
        the formatted value
      另请参阅:
        `getCustomEditor(java.lang.String)`

    - #### getCustomEditor

          @Nullable
          protected PropertyEditor getCustomEditor(String fixedField)

      Retrieve the custom PropertyEditor for the given field, if any.
      参数:
        `fixedField` - the fully qualified field name
      返回:
        the custom PropertyEditor, or `null`

    - #### findEditor

          @Nullable
          public PropertyEditor findEditor(@Nullable
                                                      String field,
                                                      @Nullable
                                                      Class<?> valueType)

      This implementation exposes a PropertyEditor adapter for a Formatter, if applicable.
      指定者:
        `findEditor` 在接口中 `BindingResult`
      覆盖:
        `findEditor` 在类中 `AbstractBindingResult`
      参数:
        `field` - the path of the property (name or nested path), or `null` if looking for an editor for all properties of the given type
        `valueType` - the type of the property (can be `null` if a property is given but should be specified in any case for consistency checking)
      返回:
        the registered editor, or `null` if none

    - #### getPropertyAccessor

          public abstract org.springframework.beans.ConfigurablePropertyAccessor getPropertyAccessor()

      Provide the PropertyAccessor to work with, according to the concrete strategy of access.

      Note that a PropertyAccessor used by a BindingResult should always have its "extractOldValueForEditor" flag set to "true" by default, since this is typically possible without side effects for model objects that serve as data binding target.

      另请参阅:
        `ConfigurablePropertyAccessor.setExtractOldValueForEditor(boolean)`