svn commit: r816350 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r816350 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java

doogie-3
Author: doogie
Date: Thu Sep 17 19:39:45 2009
New Revision: 816350

URL: http://svn.apache.org/viewvc?rev=816350&view=rev
Log:
Add support for generics markup in string type names.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java?rev=816350&r1=816349&r2=816350&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java Thu Sep 17 19:39:45 2009
@@ -56,6 +56,9 @@
      * @throws ClassNotFoundException
      */
     public static Class<?> loadClass(String className) throws ClassNotFoundException {
+        int genericsStart = className.indexOf("<");
+        if (genericsStart != -1) className = className.substring(0, genericsStart);
+
         // small block to speed things up by putting using preloaded classes for common objects, this turns out to help quite a bit...
         Class<?> theClass = CachedClassLoader.globalClassNameClassMap.get(className);
 
@@ -72,6 +75,9 @@
      * @throws ClassNotFoundException
      */
     public static Class<?> loadClass(String className, ClassLoader loader) throws ClassNotFoundException {
+        int genericsStart = className.indexOf("<");
+        if (genericsStart != -1) className = className.substring(0, genericsStart);
+
         // Handle array classes. Details in http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/types.html#wp16437
         if (className.endsWith("[]")) {
             if (Character.isLowerCase(className.charAt(0)) && className.indexOf(".") < 0) {
@@ -468,6 +474,11 @@
             return null;
         }
 
+        int genericsStart = type.indexOf("<");
+        if (genericsStart != -1) {
+            type = type.substring(0, genericsStart);
+        }
+
         if (obj.getClass().getName().equals(type)) {
             return obj;
         }