Using XML to Describe Objects

XML is handy for describing data for a code generator. XML's capability to handle structured data with ease makes it ideal for generating code.

One of the areas of Java coding that can be particularly tedious is creating JavaBeans— especially when they have a lot of properties. The properties are easy to define, and you typically implement them all the same way—at least until you start adding extra business logic to the getters and setters.

When you generate code, there's no reason you can't edit the generated code. Sometimes a code generator just makes for a good head start.

Now, to generate JavaBeans (for this example, you'll just generate properties and not events), you need a way to represent the parts of the ...

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.