org.springframework.beans.factory.config
Class CustomEditorConfigurer

java.lang.Object
  extended byorg.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. Delegates to ClassUtils for actual class name resolution.

Since:
27.02.2004
Author:
Juergen Hoeller
See Also:
ConfigurableBeanFactory.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), ClassUtils.forName(java.lang.String)

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) 2003-2004 The Spring Framework Project.