Introduction of Reflection
- Java Reflection makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time.
- It is also possible to instantiate new objects, invoke methods and get/set field values using reflection.
- Java Reflection is quite very powerful and can be very useful.
- When you mapping objects to tables in a database at runtime, like Butterfly Persistence does. Or, when mapping the statements in a script language to method calls on real objects at runtime, like Butterfly Container does when parsing its configuration scripts.
Usage of Reflection
It is a advanced feature and should be used only by
developers.
Developers who have a strong Knowledge of the fundamentals
of the language.
- Debuggers:-Debuggers can able to examine private members on classes.
- Class Browsers:-A class browser needs to be able to count the members of classes.
- Visual Development Environments:-Visual development environments can give benefit from making use of type information available in reflection to help the developer in writing right code.
- Test Tools.


