3.7. Custom Metadata

The type information stored in a Java class file is very thorough, as far as it goes. When you first move to Java from a nonreflective programming environment, the new possibilities seem limitless. Knowing the names and types of all methods and fields makes it easy to implement all sorts of runtime services for your Java objects: XML views, object/relational mappings, generic user interfaces, and on and on. Nevertheless, it is possible to imagine wanting even more metadata.

Consider the hypothetical LaunchVehicle interface shown in Listing 3-27. As a human reader, you can infer several important details about how to use this interface. For example, you know to use liters when you addFuel. From your knowledge of the problem ...

Get Component Development for the Java™ Platform 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.