Basically the reflection API includes two components: objects representing various parts of a class file and provides a way to extract those objects in a safe and secure way. Java supports several security safeguards and therefore it make sense to provide a set of classes in order to invalidate those safeguards.
The first component provided by the Reflection API
provides a mechanism that fetches information about a class. This mechanism is
developed inside the class named Class. The class
Along with these methods some more methods are also added to the class Class. Here is the listing of these methods:
Several new classes were added in order to represent
the objects that these methods would return. Most of these classes are the part
of the package
The Reflection API made a number of changes to class
Uses of Reflection
Reflection is generally used by programs that examine or modify the runtime behavior of applications running in the Java virtual machine. This relatively advanced feature should be used only by developers having a strong grasp of the fundamentals of the language. Or in other words we can say that reflection is a powerful technique that is capable of enabling the applications to perform operations which would otherwise be impossible.
An application can use user-defined classes simply by creating instances of extensibility objects by using their fully-qualified names.
Class Browsers and Visual Development Environments
Debuggers and Test Tools
Debuggers needs to be able for examining the private members on classes. Reflection can be used by test harnesses to systematically call a discoverable set APIs defined on a class, to make sure a high level of code coverage in a test suite.