Choosing Between Introspection and Reflection

Obviously, because Introspection uses Reflection, you can't avoid using Reflection whichever approach you take. There is, however, a good reason to use Introspection for analyzing Java objects rather than just using Reflection.

Introspection works at a higher level than Reflection and filters out a lot of garbage that you don't want to deal with. Bean properties are essentially the data items that a developer has deemed important—the parts of the object that other programs actually want to use. Depending on your application, you might want to work at that level—then again, you might not. Take the JOX library, for example. It deals with XML files and generally works with the public view of the data. ...

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.