ce my.package.prefix with your package prefix, of course Set<Class<? extends SomeType>> subTypes=reflections.getSubTypesOf(SomeType.class); Set<Class<?>> annotated=reflections.getTypesAnnotatedWith(SomeAnnotation.class); Set<Class<?>> annotated1=reflections.getTypesAnnotatedWith( new SomeAnnotation() {public String value() {return "1";} public Class<? extends Annotation> annotationType() {return SomeAnnotation.class;}}); basically, to use Reflections for scanning and querying, instantiate it with a {@link org.reflections.Configuration}, for example
new Reflections( new ConfigurationBuilder() .filterInputsBy(new FilterBuilder().include("your project's common package prefix here...")) .setUrls(ClasspathHelper.forClassLoader()) .setScanners(new SubTypesScanner(), new TypeAnnotationsScanner()));
and than use the convenient methods to query the metadata, such as {@link #getSubTypesOf}, {@link #getTypesAnnotatedWith}, {@link #getMethodsAnnotatedWith}, {@link #getFieldsAnnotatedWith}, {@link #getResources}
use {@link #getStore()} to access and query the store directly
in order to save a metadata use {@link #save(String)} or {@link #save(String,org.reflections.serializers.Serializer)}for example with {@link org.reflections.serializers.XmlSerializer} or {@link org.reflections.serializers.JavaCodeSerializer}
in order to collect pre saved metadata and avoid re-scanning, use {@link #collect(String,com.google.common.base.Predicate,org.reflections.serializers.Serializer)}}
* be aware that when using the constructor new Reflections("my.package"), only urls with prefix 'my.package' will be scanned, and any transitive classes in other urls will not be scanned (for example if my.package.SomeClass extends other.package.OtherClass, than the later will not be scanned). in that case use the other constructors and specify the relevant packages/urls
For Javadoc, source code, and more information about Reflections Library, see http://code.google.com/p/reflections/