Reflection: A New Way to Discover Information about Java classes
By Dan Becker2003-05-24
Conclusion
If you've followed this article closely, you should now understand the workings of the entire Java reflection programming interface. It is now entirely possible to inspect and act on Java classes on the fly. This is important for creating programs that are extensible at run time. For example, given an array of pixels and a class name (let's say it's an image processing filter), one could write a program to search for the class by name, load it, look for the right method, and run the class method on the array of pixels. Users could add new image processing filters simply by providing a new class file. There is no need to buy a new program to support updates; simply add them yourself. Now that is a powerful and flexible program!
Tutorial Pages:
» Introduction
» Outlining the Class Hierarchy Using Java 1.02
» Querying Interfaces Using Java 1.02
» An Improved Java 1.02 Reflection Program
» Using the Reflection Features of Java 1.1: Modifiers
» Using the Reflection Features of Java 1.1: Fields
» Security Issues
» Conclusion
First published by IBM DeveloperWorks
