geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r632115 - in /geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context: impl/PropertyEditorHelper.java v2c/XBeanBeanDefinitionParserDelegate.java v2c/XBeanNamespaceHandler.java
Date Thu, 28 Feb 2008 20:44:20 GMT
Author: dain
Date: Thu Feb 28 12:44:18 2008
New Revision: 632115

URL: http://svn.apache.org/viewvc?rev=632115&view=rev
Log:
Applied XBEAN-95 Register PropertyEditors locally, not globally

Modified:
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java?rev=632115&r1=632114&r2=632115&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
Thu Feb 28 12:44:18 2008
@@ -44,6 +44,19 @@
         }
     }
 
+    public static void unregisterCustomEditors() {
+        unregisterEditor("java.io.File");
+        unregisterEditor("java.net.URI");
+        unregisterEditor("java.util.Date");
+        unregisterEditor("javax.management.ObjectName");
+    }
+
+    protected static void unregisterEditor(String typeName) {
+        Class type = loadClass(typeName);
+        if (type != null) {
+            PropertyEditorManager.registerEditor(type, null);
+        }
+    }
     public static Class loadClass(String name) {
         ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
         if (contextClassLoader != null) {

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java?rev=632115&r1=632114&r2=632115&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanBeanDefinitionParserDelegate.java
Thu Feb 28 12:44:18 2008
@@ -37,10 +37,6 @@
     
     private XBeanQNameHelper qnameHelper;
     
-    static {
-        PropertyEditorHelper.registerCustomEditors();
-    }
-    
     public XBeanBeanDefinitionParserDelegate(XmlReaderContext readerContext) {
         super(readerContext);
         qnameHelper = new XBeanQNameHelper(readerContext);

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java?rev=632115&r1=632114&r2=632115&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
Thu Feb 28 12:44:18 2008
@@ -43,6 +43,8 @@
 import org.apache.xbean.spring.context.impl.NamespaceHelper;
 import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
 import org.springframework.beans.PropertyValue;
+import org.springframework.beans.PropertyEditorRegistrar;
+import org.springframework.beans.PropertyEditorRegistry;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
@@ -81,10 +83,6 @@
     public static final String SPRING_SCHEMA = "http://xbean.apache.org/schemas/spring/1.0";
     public static final String SPRING_SCHEMA_COMPAT = "http://xbean.org/schemas/spring/1.0";
 
-    static {
-        PropertyEditorHelper.registerCustomEditors();
-    }
-
     private static final Log log = LogFactory.getLog(XBeanNamespaceHandler.class);
 
     private static final String QNAME_ELEMENT = "qname";
@@ -187,7 +185,16 @@
      * Registers whatever custom editors we need
      */
     public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) {
-        PropertyEditorHelper.registerCustomEditors();
+        PropertyEditorRegistrar registrar = new PropertyEditorRegistrar() {
+            public void registerCustomEditors(PropertyEditorRegistry registry) {
+                registry.registerCustomEditor(java.io.File.class, new org.apache.xbean.spring.context.impl.FileEditor());
+                registry.registerCustomEditor(java.net.URI.class, new org.apache.xbean.spring.context.impl.URIEditor());
+                registry.registerCustomEditor(java.util.Date.class, new org.apache.xbean.spring.context.impl.DateEditor());
+                registry.registerCustomEditor(javax.management.ObjectName.class, new org.apache.xbean.spring.context.impl.ObjectNameEditor());
+            }
+        };
+
+        beanFactory.addPropertyEditorRegistrar(registrar);
     }
 
     /**



Mime
View raw message