geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r774309 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
Date Wed, 13 May 2009 12:59:53 GMT
Author: gnodet
Date: Wed May 13 12:59:53 2009
New Revision: 774309

URL: http://svn.apache.org/viewvc?rev=774309&view=rev
Log:
Make default conversions public and statically available

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java?rev=774309&r1=774308&r2=774309&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
Wed May 13 12:59:53 2009
@@ -138,7 +138,13 @@
             } catch (ClassNotFoundException e) {
                 throw new Exception("Unable to convert", e);
             }
-        } else if (Locale.class == toType) {
+        } else {
+            return defaultConversion(value, toType);
+        }
+    }
+
+    public static Object defaultConversion(String value, Class toType) throws Exception {
+        if (Locale.class == toType) {
             String[] tokens = value.split("_");
             if (tokens.length == 1) {
                 return new Locale(tokens[0]);
@@ -192,7 +198,7 @@
         }
     }
 
-    private Object createObject(String value, Class type) throws Exception {
+    private static Object createObject(String value, Class type) throws Exception {
         if (type.isInterface() || Modifier.isAbstract(type.getModifiers())) {
             throw new Exception("Unable to convert. Type class is an interface or is an abstract
class");
         }



Mime
View raw message