Java Reflection

Program-Transformation.Org: The Program Transformation Wiki

One of Java's strengths is that it was designed with the assumption that the environment in which it was running would be changing dynamically. Classes are loaded dynamically, binding is done dynamically, and object instances are created dynamically on the fly when they are needed. What has not been very dynamic historically is the ability to manipulate "anonymous" classes. In this context, an anonymous class is one that is loaded or presented to a Java class at run time and whose type was previously unknown to the Java program. [Sun 1998]

Java programs can now "reflect" upon themselves or upon an arbitrary class to determine the methods and fields defined by that class, arguments and so on. What exactly does that mean? By utilizing the packages in the Java Reflection API to obtain complete information about any object, array, method, constructor, or field.

Fundamentally, the Reflection API consists of two components: objects that represent the various parts of a class file, and a means for extracting those objects in a safe and secure way.