Overview

jInterflex is a Java open source library that invokes methods and reads public fields of classes through reflection in a different way, using annotations and interfaces. The traditional way uses the Java Reflection API which makes the code verbose and not very readable. The main use case to solve with this library is the access of functionality that may not be available at runtime (new functionality that is only available for certain versions of the JDK, or that is available if there’s a certain Jar in the classpath, etc.).

jInterflex allows to specify the methods to be invoked and the fields to be read in auxiliary interfaces, with the same signature that they actually have (or very similar), so the signatures of methods can be copied almost directly from the Javadocs of their original classes. Annotations written in these auxiliary interfaces complement the information needed to make the invocation or field access. With the help of these interfaces, the access to the methods and fields looks like the "normal" (without reflection) invokation or read access, enhancing the readability.

jInterflex requires JDK 1.5+.