Methods Summary |
---|
public java.lang.ClassLoader | getClassLoader()
if (classLoader==null) {
URL[] urls = new URL[1];
try {
urls[0] = directory.getAbsoluteFile().toURL();
classLoader = new URLClassLoader(urls);
} catch(Exception e) {
e.printStackTrace();
}
}
return classLoader;
|
public java.util.Set | getElements()
Set<Class> elements = new HashSet<Class>();
if (getClassLoader()==null) {
AnnotationUtils.getLogger().severe("Class loader null");
return elements;
}
for (String fileName : entries) {
// convert to a class name...
String className = fileName.replace(File.separatorChar, '.");
className = className.substring(0, className.length()-6);
System.out.println("Getting " + className);
try {
elements.add(classLoader.loadClass(className));
} catch(Throwable cnfe) {
AnnotationUtils.getLogger().severe("cannot load " + className + " reason : " + cnfe.getMessage());
}
}
return elements;
|
protected java.util.Set | getEntries()
return entries;
|
private void | init(java.io.File directory)
init(directory, directory);
|
private void | init(java.io.File top, java.io.File directory)
File[] dirFiles = directory.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getAbsolutePath().endsWith(".class");
}
});
for (File file : dirFiles) {
entries.add(file.getPath().substring(top.getPath().length()+1));
}
File[] subDirs = directory.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
for (File subDir : subDirs) {
init(top, subDir);
}
|