Even occasional users [of reflection] will immediately adopt the book’s patterns and idioms to solve common problems.
You are a Java developer. You are asked to add a simple feature to your application. But "simple" can be deceiving: you have to make many changes, in locations which can be difficult to find.
If this sounds familiar, you want to know about Java reflection. With reflection, you can work smarter by designing flexible applications to which you can easily add likely new requirements. Then, with a few code changes in easy-to-find places, you've got the job done. Reflection adds a new dimension to your programming skills. It will boost your effectiveness.
Java Reflection in Action starts from the basics. It gradually builds a complete understanding, adding as it goes reflective concepts illustrated with many small examples that are useful in real applications.
In a subplot, the book follows a programmer, George, as he tackles common but difficult tasks. In each case, George finds flexible, reflective solutions that replace the usual hard-coded ones. The power of reflection becomes clear through his story.
about this book
about the title
about the cover illustration
1. A few basics
2. Accessing fields reflectively
3. Dynamic loading and reflective construction
4. Using Java’s dynamic proxy
5. Call stack introspection
6. Using the class loader
7. Reflective code generation
8. Design patterns
9. Evaluating performance
10. Reflecting on the future
Appendix A: Reflection and metaobject protocols
Appendix B: Handling compilation errors in the "Hello world!" program
Appendix C: UML
- Introduction to reflective programming
- How reflective code generation can address common cross-cutting concerns
- How to load new classes dynamically into a running application
- How to decide when reflection is the best solution
About the authors
Dr. Ira Forman is a senior software engineer at IBM. He started working on reflection in the early 1990s when he developed IBM's SOM Metaclass Framework. Nate Forman works for Ticom Geomatics where he uses reflection in day-to-day problems. Ira and Nate are father and son. They live in Austin, Texas.