What Is Reflection?

According to Sun, Reflection is an API that supports introspection of the classes and objects in the current JVM. Essentially, the key word in this definition is introspection. If you're new to Java, this is probably not a term you are familiar with, especially in a software sense. Using Reflection, you can take an object at runtime, such as an ArrayList instance, examine it, and fully describe it. The information you can obtain about an object includes details about its class and about that unique object itself. As far as its class, you can learn which classes it extends, interfaces it implements, methods it provides, and fields it has. After you know this, you can determine the values held by the fields for the particular ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.