站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

CustomEditorConfigurer (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.beans.factory.config
Class CustomEditorConfigurer

java.lang.Object
  extended by org.springframework.beans.factory.config.CustomEditorConfigurer
All Implemented Interfaces:
BeanFactoryPostProcessor, Ordered

public class CustomEditorConfigurer
extends Object
implements BeanFactoryPostProcessor, Ordered

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

Configuration example, assuming XML bean definitions and inner beans for PropertyEditor instances:

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

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 DataBinder: Use a common base class or delegate to common DataBinder initialization code to reuse editor registration there.

Since:
27.02.2004
Author:
Juergen Hoeller
See Also:
ConfigurableBeanFactory.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), ClassUtils.forName(java.lang.String), DataBinder.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), BaseCommandController.initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder)

Constructor Summary
CustomEditorConfigurer()
           
 
Method Summary
 int getOrder()
          Return the order value of this object, higher value meaning greater in terms of sorting.
 void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
          Modify the application context's internal bean factory after its standard initialization.
 void setCustomEditors(Map customEditors)
          Specify the custom editors to register via a Map, using the class name of the required type as key and the PropertyEditor instance as value.
 void setOrder(int order)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomEditorConfigurer

public CustomEditorConfigurer()
Method Detail

setOrder

public void setOrder(int order)

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, higher value meaning greater in terms of sorting. Normally starting with 0 or 1, Integer.MAX_VALUE indicating greatest. Same order values will result in arbitrary positions for the affected objects.

Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Specified by:
getOrder in interface Ordered
Returns:
the order value

setCustomEditors

public void setCustomEditors(Map customEditors)
Specify the custom editors to register via a Map, using the class name of the required type as key and the PropertyEditor instance as value.

See Also:
ConfigurableBeanFactory.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor)

postProcessBeanFactory

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
                            throws BeansException
Description copied from interface: 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.

Specified by:
postProcessBeanFactory in interface BeanFactoryPostProcessor
Parameters:
beanFactory - the bean factory used by the application context
Throws:
BeansException - in case of errors


Copyright (c) 2002-2007 The Spring Framework Project.