Inspect4J
Inspect4J is a (free of charge) Java library thought to be used in your Java application. It solves a standard problem that probably is known by any Java programmer: Search a classpath (jars and/or directories) for classes implementing a given interface or extending a given class. There are various scenarios where it's reasonable to use dynamic class search inside your application:
- Search for all Data Transfer Objects (DTOs) inside your application's startup code and register them at hibernate manager
- Dynamically load all classes that are implementing your plugin interface
- Load classes that extend your abstract class for data export (HTML, TXT, XML, ...) and build a context menu offering their functionality
- Simplify developing of java based code generators which like to produce code for all implementors of a given interface or extending a given class
- Search all your TableModels and run tests on them like check if getColumnClass returns the right Class for each column
- Search all serializable classes and serialize them to ensure all their fields are serializable
- Consider you have a bunch of BusinessObjects (BOs) and a factory that returns an Swing-based editor for each BO. Use Inspect4J to test if you have really an editor for each BO in your productive code.
Inspect4J is a cutout of the REFLECTK framework missing the following REFLECTK's features:
- Absolutely no CQL (dynamic query language) support
- No sourcecode reading support (only classes, see next issue)
- Classes are inspected via reflection instead of reading the classes' bytecode (which has many advantages)
- Can search only classes (REFLECTK can search packages, classes, constructors, methods, fields, annotations, instructions and resources)
- Can only filter for inheritance. REFLECTK comes with more than 30 filters like PackageFilter, ModifierFilter, SignatureFilter, TypeFilter, ReturntypeFilter, ...
- Hard wired ExceptionHandler that prints Exceptions that will occur during search to STDERR
- ...and many, many more
Usage is more than simple:
Download Inspect4J now. Inspect4J may be used in non-commercial as well as in commercial applications.