Skip to content

Instantly share code, notes, and snippets.

@xsalefter
Created February 14, 2012 07:21
Show Gist options
  • Select an option

  • Save xsalefter/1824474 to your computer and use it in GitHub Desktop.

Select an option

Save xsalefter/1824474 to your computer and use it in GitHub Desktop.
// Result: [class com.thermetics.bug.classes.TestClass]
public class Program {
public static void main(String[] args) {
Set<URL> urls = new HashSet<URL>();
// Change this in ur favor..
urls.addAll(ClasspathHelper.forPackage("com.thermetics.bug"));
urls.add(ClasspathHelper.forClass(TestAnnotation.class));
ConfigurationBuilder builder = new ConfigurationBuilder().
addUrls(urls);
Reflections r = new Reflections(builder);
Set<Class<?>> types = r.getTypesAnnotatedWith(TestAnnotation.class);
System.out.println(types);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment