/Users/lyon/j4p/src/classUtils/reflection/FindCompObj.java

1    //Ryan Metz 
2    package classUtils.reflection; 
3     
4    import java.io.File; 
5    import java.util.Vector; 
6     
7    import classUtils.putils.ClassPathUtils; 
8    import net.compute.DelegatingLoader; 
9     
10   public class FindCompObj { 
11    
12       static Vector classVector = new Vector(); 
13    
14       public static Vector getClassVector() { 
15           return classVector; 
16       } 
17    
18       public static void getCompObjList() { 
19    
20           File f[] = ClassPathUtils.getClassFiles(); 
21           DelegatingLoader d = new DelegatingLoader 
22                   ("C:\\lyon\\j4p\\classes\\"); 
23    
24    
25           for (int i = 0; i < f.length; i++) { 
26               String s = ClassPathUtils.makeClassString(f[i].toString()); 
27    
28    
29               try { 
30    
31                   Class c = d.loadClass(s, true); 
32                   ReflectUtil r = new ReflectUtil(c); 
33                   Class classFileArray[] = r.getSuperInterfaces(c); 
34    
35    
36                   for (int j = 0; j < classFileArray.length; j++) { 
37    
38    
39                       if (classFileArray[j].getName().equals 
40                               ("net.compute.ComputableObject")) { 
41                           classVector.addElement(c); 
42                           System.out.println(c.getName()); 
43                           continue; 
44                       }//if 
45                       // else System.out.println(f[i].toString()); 
46                   }  //for2 
47               }  //try 
48               catch (ClassNotFoundException e) { 
49                   continue; 
50               }  //catch 
51           } //for1 
52       } //main 
53   } //FindCompObj 
54