db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r538367 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java
Date Tue, 15 May 2007 23:03:39 GMT
Author: arminw
Date: Tue May 15 16:03:38 2007
New Revision: 538367

URL: http://svn.apache.org/viewvc?view=rev&rev=538367
Log:
add shortcut name support

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java?view=diff&rev=538367&r1=538366&r2=538367
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/CollectionTypes.java
Tue May 15 16:03:38 2007
@@ -32,6 +32,7 @@
 import org.apache.ojb.broker.util.configuration.Configuration;
 import org.apache.ojb.broker.util.configuration.ConfigurationException;
 import org.apache.ojb.broker.util.ClassHelper;
+import org.apache.ojb.broker.util.ShortcutMapper;
 
 /**
  * This class provide the default collection implementation classes for 1:n, m:n references
@@ -58,20 +59,25 @@
 
     public void configure(Configuration pConfig) throws ConfigurationException
     {
-        oneToManyArray = pConfig.getClass("CollectionTypes.OneToManyArray", ManageableArrayList.class);
-        oneToManyCollection = pConfig.getClass("CollectionTypes.OneToManyCollection", ManageableArrayList.class);
-        oneToManyList = pConfig.getClass("CollectionTypes.OneToManyList", ManageableArrayList.class);
-        oneToManyVector = pConfig.getClass("CollectionTypes.OneToManyVector", ManageableVector.class);
-        oneToManySet = pConfig.getClass("CollectionTypes.OneToManySet", ManageableHashSet.class);
-
-        manyToManyArray = pConfig.getClass("CollectionTypes.ManyToManyArray", ManageableArrayList.class);
-        manyToManyCollection = pConfig.getClass("CollectionTypes.ManyToManyCollection", ManageableArrayList.class);
-        manyToManyList = pConfig.getClass("CollectionTypes.ManyToManyList", ManageableArrayList.class);
-        manyToManyVector = pConfig.getClass("CollectionTypes.ManyToManyVector", ManageableVector.class);
-        manyToManySet = pConfig.getClass("CollectionTypes.ManyToManySet", ManageableHashSet.class);
+        oneToManyArray = resolveName(pConfig.getString("CollectionTypes.OneToManyArray",
ManageableArrayList.class.getName()));
+        oneToManyCollection = resolveName(pConfig.getString("CollectionTypes.OneToManyCollection",
ManageableArrayList.class.getName()));
+        oneToManyList = resolveName(pConfig.getString("CollectionTypes.OneToManyList", ManageableArrayList.class.getName()));
+        oneToManyVector = resolveName(pConfig.getString("CollectionTypes.OneToManyVector",
ManageableVector.class.getName()));
+        oneToManySet = resolveName(pConfig.getString("CollectionTypes.OneToManySet", ManageableHashSet.class.getName()));
+
+        manyToManyArray = resolveName(pConfig.getString("CollectionTypes.ManyToManyArray",
ManageableArrayList.class.getName()));
+        manyToManyCollection = resolveName(pConfig.getString("CollectionTypes.ManyToManyCollection",
ManageableArrayList.class.getName()));
+        manyToManyList = resolveName(pConfig.getString("CollectionTypes.ManyToManyList",
ManageableArrayList.class.getName()));
+        manyToManyVector = resolveName(pConfig.getString("CollectionTypes.ManyToManyVector",
ManageableVector.class.getName()));
+        manyToManySet = resolveName(pConfig.getString("CollectionTypes.ManyToManySet", ManageableHashSet.class.getName()));
 
-        query = pConfig.getClass("CollectionTypes.Query", ManageableArrayList.class);
-        OQLQuery = pConfig.getClass("CollectionTypes.OQLQuery", ManageableArrayList.class);
+        query = resolveName(pConfig.getString("CollectionTypes.Query", ManageableArrayList.class.getName()));
+        OQLQuery = resolveName(pConfig.getString("CollectionTypes.OQLQuery", ManageableArrayList.class.getName()));
+    }
+
+    private Class resolveName(String name)
+    {
+        return ShortcutMapper.resolve(name, ManageableCollection.class);
     }
 
     public ManageableCollection createCollectionClass(CollectionDescriptor cold)
@@ -95,7 +101,7 @@
         if(result == null)
         {
             Class fieldType = cds.getPersistentField().getType();
-            
+
             if (ManageableCollection.class.isAssignableFrom(fieldType))
             {
                 result = fieldType;



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message