Using Introspection in an Application

You use Introspection in an application in basically the same places you use Reflection. You typically use Introspection in utility classes that map Java objects onto some other medium (database, XML, network) and in graphical user interfaces.

The JOX library that you saw in Chapter 24, "Using Java-XML Tools," uses Introspection to map Java objects to XML and map XML to Java objects. In fact, the reason that JOX works with JavaBeans instead of any Java object is that JOX uses Reflection.

Introspection makes a lot of sense for GUI applications in which you create an automated tool to copy data between data objects and graphics components. You will see several examples of this technique in the next chapter. ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.