new Reflections( new ConfigurationBuilder() .filterInputsBy(new FilterBuilder().include("your project's common package prefix here...")) .setUrls(ClasspathHelper.forClassLoader()) .setScanners(new SubTypesScanner(), new TypeAnnotationsScanner().filterResultsBy(myClassAnnotationsFilter)));and than use the convenient methods to query the metadata, such as {@link #getSubTypesOf}, {@link #getTypesAnnotatedWith}, {@link #getMethodsAnnotatedWith}, {@link #getFieldsAnnotatedWith}, {@link #getResources}
in order to save a metadata use {@link #save(String)} or {@link #save(String,org.jboss.errai.reflections.serializers.Serializer)}for example with {@link org.jboss.errai.reflections.serializers.XmlSerializer} or {@link org.jboss.errai.reflections.serializers.JavaCodeSerializer}
in order to collect pre saved metadata and avoid re-scanning, use {@link #collect(String,com.google.common.base.Predicate)}
* 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 specify the urls manually using {@link ConfigurationBuilder}
For Javadoc, source code, and more information about Reflections Library, see http://code.google.com/p/reflections/
|
|
|
|
|
|