Finding classes

/ Published in: Java
Save to your folder(s)

Using in order to find a class in class path.

Copy this code and paste it in your HTML
  1. File moduleFile = new File(Catalog.class.getProtectionDomain().getCodeSource().getLocation().toURI());
  2. final ClassFinder finder = new ClassFinder();
  3. finder.clear();
  4. assertTrue(finder.add(moduleFile));
  5. final ClassFilter filter = new AndClassFilter(new NotClassFilter(new InterfaceOnlyClassFilter()), new NotClassFilter(new AbstractClassFilter()), new SubclassClassFilter(UpdateTask.class));
  6. Collection<ClassInfo> foundClasses = new ArrayList<ClassInfo>();
  7. finder.findClasses(foundClasses, filter);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.