commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1088096 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
Date Sat, 02 Apr 2011 19:44:59 GMT
Author: simonetripodi
Date: Sat Apr  2 19:44:58 2011
New Revision: 1088096

URL: http://svn.apache.org/viewvc?rev=1088096&view=rev
Log:
added generics to ClassLoader
type agnostic Vector replaced by LinkedList<ClassLoader>

Modified:
    commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java

Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java?rev=1088096&r1=1088095&r2=1088096&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
(original)
+++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/ClassLoaders.java
Sat Apr  2 19:44:58 2011
@@ -16,7 +16,8 @@
  */
 package org.apache.commons.discovery.resource;
 
-import java.util.Vector;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.commons.discovery.jdk.JDKHooks;
 
@@ -33,7 +34,7 @@ import org.apache.commons.discovery.jdk.
  */
 public class ClassLoaders
 {
-    protected Vector classLoaders = new Vector();
+    protected List<ClassLoader> classLoaders = new LinkedList<ClassLoader>();
     
     /** Construct a new class loader set
      */
@@ -45,7 +46,7 @@ public class ClassLoaders
     }
     
     public ClassLoader get(int idx) {
-        return (ClassLoader)classLoaders.elementAt(idx);
+        return classLoaders.get(idx);
     }
 
     /**
@@ -55,7 +56,7 @@ public class ClassLoaders
      */
     public void put(ClassLoader classLoader) {
         if (classLoader != null) {
-            classLoaders.addElement(classLoader);
+            classLoaders.add(classLoader);
         }
     }
     
@@ -71,7 +72,7 @@ public class ClassLoaders
      */
     public void put(ClassLoader classLoader, boolean prune) {
         if (classLoader != null  &&  !(prune && isAncestor(classLoader)))
{
-            classLoaders.addElement(classLoader);
+            classLoaders.add(classLoader);
         }
     }
     
@@ -127,7 +128,7 @@ public class ClassLoaders
      * @param factory WHO is performing the lookup.
      * @param prune Determines if ancestors are allowed to be loaded or not.
      */    
-    public static ClassLoaders getLibLoaders(Class spi, Class factory, boolean prune) {
+    public static ClassLoaders getLibLoaders(Class<?> spi, Class<?> factory,
boolean prune) {
         ClassLoaders loaders = new ClassLoaders();
         
         if (spi != null) loaders.put(spi.getClassLoader());
@@ -157,7 +158,7 @@ public class ClassLoaders
      * @param factory WHO is performing the lookup (factory).
      * @param prune Determines if ancestors are allowed to be loaded or not.
      */    
-    public static ClassLoaders getAppLoaders(Class spi, Class factory, boolean prune) {
+    public static ClassLoaders getAppLoaders(Class<?> spi, Class<?> factory,
boolean prune) {
         ClassLoaders loaders = new ClassLoaders();
 
         loaders.put(JDKHooks.getJDKHooks().getThreadContextClassLoader());



Mime
View raw message