db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1351124 - in /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque: Torque.java TorqueInstance.java avalon/Torque.java
Date Sun, 17 Jun 2012 16:49:55 GMT
Author: tv
Date: Sun Jun 17 16:49:55 2012
New Revision: 1351124

URL: http://svn.apache.org/viewvc?rev=1351124&view=rev
Log:
Improve generics handling a bit

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java?rev=1351124&r1=1351123&r2=1351124&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Torque.java Sun
Jun 17 16:49:55 2012
@@ -27,6 +27,7 @@ import org.apache.torque.adapter.DB;
 import org.apache.torque.manager.AbstractBaseManager;
 import org.apache.torque.map.DatabaseMap;
 import org.apache.torque.oid.IDBroker;
+import org.apache.torque.om.Persistent;
 
 /**
  * A static facade wrapper around the Torque implementation (which is in
@@ -92,6 +93,7 @@ public final class Torque
      */
     private Torque()
     {
+        // not used
     }
 
     /**
@@ -190,7 +192,7 @@ public final class Torque
      *
      * @return The requested Manager.
      */
-    public static AbstractBaseManager<?> getManager(String name)
+    public static <T extends Persistent> AbstractBaseManager<T> getManager(String
name)
     {
         return getInstance().getManager(name);
     }
@@ -204,7 +206,7 @@ public final class Torque
      *
      * @return a Manager
      */
-    public static AbstractBaseManager<?> getManager(String name,
+    public static <T extends Persistent> AbstractBaseManager<T> getManager(String
name,
             String defaultClassName)
     {
         return getInstance().getManager(name, defaultClassName);

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java?rev=1351124&r1=1351123&r2=1351124&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
Sun Jun 17 16:49:55 2012
@@ -41,6 +41,7 @@ import org.apache.torque.manager.Abstrac
 import org.apache.torque.map.DatabaseMap;
 import org.apache.torque.oid.IDBroker;
 import org.apache.torque.oid.IDGeneratorFactory;
+import org.apache.torque.om.Persistent;
 import org.apache.torque.util.Transaction;
 import org.apache.torque.util.TransactionManager;
 import org.apache.torque.util.TransactionManagerImpl;
@@ -762,9 +763,10 @@ public class TorqueInstance
      * @param name name of the manager
      * @return a Manager
      */
-    public AbstractBaseManager<?> getManager(String name)
+    public <T extends Persistent> AbstractBaseManager<T> getManager(String name)
     {
-        AbstractBaseManager<?> m = managers.get(name);
+        @SuppressWarnings("unchecked")
+        AbstractBaseManager<T> m = (AbstractBaseManager<T>)managers.get(name);
         if (m == null)
         {
             log.error("No configured manager for key " + name + ".");
@@ -781,10 +783,11 @@ public class TorqueInstance
      *
      * @return a Manager
      */
-    public AbstractBaseManager<?> getManager(String name,
+    @SuppressWarnings("unchecked")
+    public <T extends Persistent> AbstractBaseManager<T> getManager(String name,
             String defaultClassName)
     {
-        AbstractBaseManager<?> m = managers.get(name);
+        AbstractBaseManager<T> m = (AbstractBaseManager<T>)managers.get(name);
         if (m == null)
         {
             log.debug("Added late Manager mapping for Class: "
@@ -800,7 +803,7 @@ public class TorqueInstance
             }
 
             // Try again now that the default manager should be in the map
-            m = managers.get(name);
+            m = (AbstractBaseManager<T>)managers.get(name);
         }
 
         return m;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java?rev=1351124&r1=1351123&r2=1351124&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/avalon/Torque.java
Sun Jun 17 16:49:55 2012
@@ -28,6 +28,7 @@ import org.apache.torque.TorqueException
 import org.apache.torque.adapter.DB;
 import org.apache.torque.manager.AbstractBaseManager;
 import org.apache.torque.map.DatabaseMap;
+import org.apache.torque.om.Persistent;
 
 /**
  * Avalon role interface for Torque.
@@ -72,7 +73,7 @@ public interface Torque
      * @param name name of the manager
      * @return a Manager
      */
-    AbstractBaseManager<?> getManager(String name);
+    <T extends Persistent> AbstractBaseManager<T> getManager(String name);
 
     /**
      * This methods returns either the Manager from the configuration file,
@@ -82,7 +83,7 @@ public interface Torque
      * @param defaultClassName the class to use if name has not been configured
      * @return a Manager
      */
-    AbstractBaseManager<?> getManager(String name, String defaultClassName);
+    <T extends Persistent> AbstractBaseManager<T> getManager(String name, String
defaultClassName);
 
     /**
      * Returns the default database map information.



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


Mime
View raw message