APPENDIX K MORE ON BUILDERS

Chapters 19 and 20 introduced the notion of Groovy builders. Essentially, Groovy builders allow us to easily represent nested treelike data structures such as XML data. With a builder, specifically a MarkupBuilder, we can effortlessly construct XML data. With a SwingBuilder, we can effortlessly construct a GUI application comprised of Swing components.

In this appendix, we consider an AntBuilder that we can use to construct Ant XML build files (Holzner, 2005) and execute them without having to deal with XML. Also, we briefly demonstrate how we can make our own specialized builders. We assume prior knowledge of Ant.

K.1 ANTBUILDER

Groovy provides the AntBuilder class with which we can easily construct and execute ...

Get Groovy Programming 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.