REFLECTK is a Java-based framework capable to inspect any classpaths and to search for relevant entities that match a specified condition. It operates on bytecode as well as on source code level. According to the Java language, supported entities are:
- Classpath entries
To enable all kind of search criterion, concepts similar to propositional logic and first-order logic can be used. This is achieved by composition of search filters. Each filter is responsible for a specific task, e.g. filtering all classes that implement a certain interface. The underlying search engine uses the passed search filters to determine matching entities.
To switch to the surrounding context of the inspected entity, so called context switch strategies can be used. If the inspected entity is a package object, it is possible to get all included classes within this package by selecting the proper strategy. Another example would be to determine all packages within a classpath entry (e.g. reflectk.jar). These strategies work along the transition of the containment relation:
- Classpath entries contain packages and classes
- Packages contain classes and annotations
- Classes contain annotations, methods, constructors and fields
- Methods contain annotations and instructions
- Constructors contain annotations and instructions
- Fields contain annotations
All this concepts are used by REFLECTK's search engine. To react to exception during the search process, which may be raised by unresolveable references or inconsistent classpaths, a custom exception handler can be plugged in. Furthermore the visitor pattern is utilized to keep track of found entities.