org.springframework.beans.factory.config

## 类 CustomEditorConfigurer

- java.lang.Object
- - org.springframework.beans.factory.config.CustomEditorConfigurer

- 所有已实现的接口:
    BeanFactoryPostProcessor, org.springframework.core.Ordered

      public class CustomEditorConfigurer
      extends Object
      implements BeanFactoryPostProcessor, org.springframework.core.Ordered

  `BeanFactoryPostProcessor` implementation that allows for convenient registration of custom `property editors`.

  In case you want to register `PropertyEditor` instances, the recommended usage as of Spring 2.0 is to use custom `PropertyEditorRegistrar` implementations that in turn register any desired editor instances on a given `registry`. Each PropertyEditorRegistrar can register any number of custom editors.

       <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
         <property name="propertyEditorRegistrars">
           <list>
             <bean class="mypackage.MyCustomDateEditorRegistrar"/>
             <bean class="mypackage.MyObjectEditorRegistrar"/>
           </list>
         </property>
       </bean>

  It's perfectly fine to register `PropertyEditor` classes via the `customEditors` property. Spring will create fresh instances of them for each editing attempt then:

       <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
         <property name="customEditors">
           <map>
             <entry key="java.util.Date" value="mypackage.MyCustomDateEditor"/>
             <entry key="mypackage.MyObject" value="mypackage.MyObjectEditor"/>
           </map>
         </property>
       </bean>

  Note, that you shouldn't register `PropertyEditor` bean instances via the `customEditors` property as `PropertyEditor`s are stateful and the instances will then have to be synchronized for every editing attempt. In case you need control over the instantiation process of `PropertyEditor`s, use a `PropertyEditorRegistrar` to register them.

  Also supports "java.lang.String[]"-style array class names and primitive class names (e.g. "boolean"). Delegates to `ClassUtils` for actual class name resolution.

  NOTE: Custom property editors registered with this configurer do not apply to data binding. Custom editors for data binding need to be registered on the `org.springframework.validation.DataBinder`: Use a common base class or delegate to common PropertyEditorRegistrar implementations to reuse editor registration there.

  从以下版本开始:
    27.02.2004
  作者:
    Juergen Hoeller
  另请参阅:
    `PropertyEditor`, `PropertyEditorRegistrar`, `ConfigurableBeanFactory.addPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar)`, `ConfigurableBeanFactory.registerCustomEditor(java.lang.Class<?>, java.lang.Class<? extends java.beans.PropertyEditor>)`, `org.springframework.validation.DataBinder#registerCustomEditor`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected Log` | `logger`

    - ### 从接口继承的字段 org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `int` | `getOrder()`
    `void` | `postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)` Modify the application context's internal bean factory after its standard initialization.
    `void` | `setCustomEditors(Map<Class<?>,Class<? extends PropertyEditor>> customEditors)` Specify the custom editors to register via a `Map`, using the class name of the required type as the key and the class name of the associated `PropertyEditor` as value.
    `void` | `setOrder(int order)`
    `void` | `setPropertyEditorRegistrars(PropertyEditorRegistrar[] propertyEditorRegistrars)` Specify the `PropertyEditorRegistrars` to apply to beans defined within the current application context.

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

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

- - ### 字段详细资料

    - #### logger

          protected final Log logger

  - ### 构造器详细资料

    - #### CustomEditorConfigurer

          public CustomEditorConfigurer()

  - ### 方法详细资料

    - #### setOrder

          public void setOrder(int order)

    - #### getOrder

          public int getOrder()

      指定者:
        `getOrder` 在接口中 `org.springframework.core.Ordered`

    - #### setPropertyEditorRegistrars

          public void setPropertyEditorRegistrars(PropertyEditorRegistrar[] propertyEditorRegistrars)

      Specify the `PropertyEditorRegistrars` to apply to beans defined within the current application context.

      This allows for sharing `PropertyEditorRegistrars` with `DataBinders`, etc. Furthermore, it avoids the need for synchronization on custom editors: A `PropertyEditorRegistrar` will always create fresh editor instances for each bean creation attempt.

      另请参阅:
        `ConfigurableBeanFactory.addPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar)`

    - #### setCustomEditors

          public void setCustomEditors(Map<Class<?>,Class<? extends PropertyEditor>> customEditors)

      Specify the custom editors to register via a `Map`, using the class name of the required type as the key and the class name of the associated `PropertyEditor` as value.
      另请参阅:
        `ConfigurableBeanFactory.registerCustomEditor(java.lang.Class<?>, java.lang.Class<? extends java.beans.PropertyEditor>)`

    - #### postProcessBeanFactory

          public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
                                      throws BeansException

      从接口复制的说明: `BeanFactoryPostProcessor`
      Modify the application context's internal bean factory after its standard initialization. All bean definitions will have been loaded, but no beans will have been instantiated yet. This allows for overriding or adding properties even to eager-initializing beans.
      指定者:
        `postProcessBeanFactory` 在接口中 `BeanFactoryPostProcessor`
      参数:
        `beanFactory` - the bean factory used by the application context
      抛出:
        `BeansException` - in case of errors