Chapter 13. Reflection
The Reflection mechanism, new in JDK 1.1, is a means to allow one object to interrogate another object and discover its data members, methods, and supported interfaces at runtime. In GUI programming in Java, you might commonly use a method such as getSource() or getClass() to identify the component that generated an event. The Reflection mechanism, however, is more generalized than this usage and can be used by any object at any time to learn about an unknown object at runtime. For those with CORBA background, this process is similar to dynamic interface invocation—that is, learning about an object from the Interface repository and then creating and using that object. Because Reflection is not very complicated, this chapter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access