org.springframework.beans

## 类 PropertyEditorRegistrySupport

- java.lang.Object
- - org.springframework.beans.PropertyEditorRegistrySupport

- 所有已实现的接口:
    PropertyEditorRegistry
  直接已知子类:
    TypeConverterSupport

      public class PropertyEditorRegistrySupport
      extends Object
      implements PropertyEditorRegistry

  Base implementation of the `PropertyEditorRegistry` interface. Provides management of default editors and custom editors. Mainly serves as base class for `BeanWrapperImpl`.
  从以下版本开始:
    1.2.6
  作者:
    Juergen Hoeller, Rob Harrop
  另请参阅:
    `PropertyEditorManager`, `PropertyEditorSupport.setAsText(java.lang.String)`, `PropertyEditorSupport.setValue(java.lang.Object)`

- - ### 构造器概要

    构造器
    构造器和说明
    `PropertyEditorRegistrySupport()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `copyCustomEditorsTo(PropertyEditorRegistry target, String nestedProperty)` Copy the custom editors registered in this instance to the given target registry.
    `protected void` | `copyDefaultEditorsTo(PropertyEditorRegistrySupport target)` Copy the default editors registered in this instance to the given target registry.
    `PropertyEditor` | `findCustomEditor(Class<?> requiredType, String propertyPath)` Find a custom property editor for the given type and property.
    `org.springframework.core.convert.ConversionService` | `getConversionService()` Return the associated ConversionService, if any.
    `PropertyEditor` | `getDefaultEditor(Class<?> requiredType)` Retrieve the default editor for the given property type, if any.
    `protected Class<?>` | `getPropertyType(String propertyPath)` Determine the property type for the given property path.
    `protected Class<?>` | `guessPropertyTypeFromEditors(String propertyName)` Guess the property type of the specified property from the registered custom editors (provided that they were registered for a specific type).
    `boolean` | `hasCustomEditorForElement(Class<?> elementType, String propertyPath)` Determine whether this registry contains a custom editor for the specified array/collection element.
    `void` | `overrideDefaultEditor(Class<?> requiredType, PropertyEditor propertyEditor)` Override the default editor for the specified type with the given property editor.
    `void` | `registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor)` Register the given custom property editor for all properties of the given type.
    `void` | `registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor)` Register the given custom property editor for the given type and property, or for all properties of the given type.
    `protected void` | `registerDefaultEditors()` Activate the default editors for this registry instance, allowing for lazily registering default editors when needed.
    `void` | `setConversionService(org.springframework.core.convert.ConversionService conversionService)` Specify a Spring 3.0 ConversionService to use for converting property values, as an alternative to JavaBeans PropertyEditors.
    `void` | `useConfigValueEditors()` Activate config value editors which are only intended for configuration purposes, such as `StringArrayPropertyEditor`.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

    - #### PropertyEditorRegistrySupport

          public PropertyEditorRegistrySupport()

  - ### 方法详细资料

    - #### setConversionService

          public void setConversionService(@Nullable
                                           org.springframework.core.convert.ConversionService conversionService)

      Specify a Spring 3.0 ConversionService to use for converting property values, as an alternative to JavaBeans PropertyEditors.

    - #### getConversionService

          @Nullable
          public org.springframework.core.convert.ConversionService getConversionService()

      Return the associated ConversionService, if any.

    - #### registerDefaultEditors

          protected void registerDefaultEditors()

      Activate the default editors for this registry instance, allowing for lazily registering default editors when needed.

    - #### useConfigValueEditors

          public void useConfigValueEditors()

      Activate config value editors which are only intended for configuration purposes, such as `StringArrayPropertyEditor`.

      Those editors are not registered by default simply because they are in general inappropriate for data binding purposes. Of course, you may register them individually in any case, through `registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor)`.

    - #### overrideDefaultEditor

          public void overrideDefaultEditor(Class<?> requiredType,
                                            PropertyEditor propertyEditor)

      Override the default editor for the specified type with the given property editor.

      Note that this is different from registering a custom editor in that the editor semantically still is a default editor. A ConversionService will override such a default editor, whereas custom editors usually override the ConversionService.

      参数:
        `requiredType` - the type of the property
        `propertyEditor` - the editor to register
      另请参阅:
        `registerCustomEditor(Class, PropertyEditor)`

    - #### getDefaultEditor

          @Nullable
          public PropertyEditor getDefaultEditor(Class<?> requiredType)

      Retrieve the default editor for the given property type, if any.

      Lazily registers the default editors, if they are active.

      参数:
        `requiredType` - type of the property
      返回:
        the default editor, or `null` if none found
      另请参阅:
        `registerDefaultEditors()`

    - #### copyDefaultEditorsTo

          protected void copyDefaultEditorsTo(PropertyEditorRegistrySupport target)

      Copy the default editors registered in this instance to the given target registry.
      参数:
        `target` - the target registry to copy to

    - #### registerCustomEditor

          public void registerCustomEditor(Class<?> requiredType,
                                           PropertyEditor propertyEditor)

      从接口复制的说明: `PropertyEditorRegistry`
      Register the given custom property editor for all properties of the given type.
      指定者:
        `registerCustomEditor` 在接口中 `PropertyEditorRegistry`
      参数:
        `requiredType` - the type of the property
        `propertyEditor` - the editor to register

    - #### registerCustomEditor

          public void registerCustomEditor(@Nullable
                                           Class<?> requiredType,
                                           @Nullable
                                           String propertyPath,
                                           PropertyEditor propertyEditor)

      从接口复制的说明: `PropertyEditorRegistry`
      Register the given custom property editor for the given type and property, or for all properties of the given type.

      If the property path denotes an array or Collection property, the editor will get applied either to the array/Collection itself (the `PropertyEditor` has to create an array or Collection value) or to each element (the `PropertyEditor` has to create the element type), depending on the specified required type.

      Note: Only one single registered custom editor per property path is supported. In the case of a Collection/array, do not register an editor for both the Collection/array and each element on the same property.

      For example, if you wanted to register an editor for "items[n].quantity" (for all values n), you would use "items.quantity" as the value of the 'propertyPath' argument to this method.

      指定者:
        `registerCustomEditor` 在接口中 `PropertyEditorRegistry`
      参数:
        `requiredType` - the type of the property. This may be `null` if a property is given but should be specified in any case, in particular in case of a Collection - making clear whether the editor is supposed to apply to the entire Collection itself or to each of its entries. So as a general rule: Do not specify `null` here in case of a Collection/array!
        `propertyPath` - the path of the property (name or nested path), or `null` if registering an editor for all properties of the given type
        `propertyEditor` - editor to register

    - #### findCustomEditor

          @Nullable
          public PropertyEditor findCustomEditor(@Nullable
                                                            Class<?> requiredType,
                                                            @Nullable
                                                            String propertyPath)

      从接口复制的说明: `PropertyEditorRegistry`
      Find a custom property editor for the given type and property.
      指定者:
        `findCustomEditor` 在接口中 `PropertyEditorRegistry`
      参数:
        `requiredType` - the type of the property (can be `null` if a property is given but should be specified in any case for consistency checking)
        `propertyPath` - the path of the property (name or nested path), or `null` if looking for an editor for all properties of the given type
      返回:
        the registered editor, or `null` if none

    - #### hasCustomEditorForElement

          public boolean hasCustomEditorForElement(@Nullable
                                                   Class<?> elementType,
                                                   @Nullable
                                                   String propertyPath)

      Determine whether this registry contains a custom editor for the specified array/collection element.
      参数:
        `elementType` - the target type of the element (can be `null` if not known)
        `propertyPath` - the property path (typically of the array/collection; can be `null` if not known)
      返回:
        whether a matching custom editor has been found

    - #### getPropertyType

          @Nullable
          protected Class<?> getPropertyType(String propertyPath)

      Determine the property type for the given property path.

      Called by `findCustomEditor(java.lang.Class<?>, java.lang.String)` if no required type has been specified, to be able to find a type-specific editor even if just given a property path.

      The default implementation always returns `null`. BeanWrapperImpl overrides this with the standard `getPropertyType` method as defined by the BeanWrapper interface.

      参数:
        `propertyPath` - the property path to determine the type for
      返回:
        the type of the property, or `null` if not determinable
      另请参阅:
        `PropertyAccessor.getPropertyType(String)`

    - #### guessPropertyTypeFromEditors

          @Nullable
          protected Class<?> guessPropertyTypeFromEditors(String propertyName)

      Guess the property type of the specified property from the registered custom editors (provided that they were registered for a specific type).
      参数:
        `propertyName` - the name of the property
      返回:
        the property type, or `null` if not determinable

    - #### copyCustomEditorsTo

          protected void copyCustomEditorsTo(PropertyEditorRegistry target,
                                             @Nullable
                                             String nestedProperty)

      Copy the custom editors registered in this instance to the given target registry.
      参数:
        `target` - the target registry to copy to
        `nestedProperty` - the nested property path of the target registry, if any. If this is non-null, only editors registered for a path below this nested property will be copied. If this is null, all editors will be copied.