Latest version of Rebound is version 0.2
Rebound is a Java library for looking up subclasses of a given class or interface using Java reflection. Rebound allows your to look up your classes within a jar file and should work with maven. It finds your classes in your classpath and does not load every class into memory so it should be efficient and fast.
If there is any problem, you are welcome to report them. I will try to help.
Changes from 0.1.4
- new rebound constructor was added to allow exclusion of either abstract or interface
- remove log4j.properties inside the library
- updated junit and fixed minor bugs
You can use rebound to find subclasses under a given package. By default, Rebound does not include abstract classes and interfaces.
import gigadot.exp.reflects.core.Processor; Rebound r = new Rebound("gigadot.exp.reflects"); Set<Class<? extends Processor>> classes = r.getSubClassesOf(Processor.class);
If you want to include abstract classes and interfaces, you can use the other constructor to specify the inclusion.
import gigadot.exp.reflects.core.Processor; Rebound r = new Rebound("gigadot.exp.reflects", true); Set<Class<? extends Processor>> classes = r.getSubClassesOf(Processor.class);
Notice that the prefix given for filtering does not filter out your given superclass. This is very useful because your superclass is usually not from the same package of your subclasses.
Rebound can find your subclasses inside the jar files under your classpath even if the package prefix is empty. However, this process is lengthy and memory consuming. Thus, it is highly recommended not to use Rebound without package prefix.
Rebound has been test with standard maven project but it may not behave correctly when it is integrated with OSGi framework.
Rebound can be downloaded from here - rebound-0.2.jar
Add the following repository and dependency to your pom.xml in oreder to include Rebound in your project. Rebound depends on apache log4j. You may need to include log4j in your project dependency.
<dependencies> <dependency> <groupId>gigadot.rebound</groupId> <artifactId>rebound</artifactId> <version>0.2</version> </dependency> </dependencies> <repositories> <repository> <id>gigadot.net</id> <url>https://maven2.gigadot.net/</url> </repository> </repositories>
Any problem using this library, please contact me. I cannot guarantee that this library is 100% free of bug but you are very welcome to spot and report them.