Chapter 17Groovy Builders
Builders are internal DSLs that provide ease in working with certain types of problems. For instance, if we need to work with nested, hierarchical structures, such as tree structures, XML, HTML, or JavaScript Object Notation (JSON) representations, we’ll find builders to be very useful. They provide syntax that does not tie us tightly to the underlying structure or implementation. They don’t replace the underlying implementation; instead, they provide an elegant way to work with it.
We can use Groovy builders for a number of everyday tasks, including working with XML, JSON, HTML, DOM, SAX, Swing, and even Ant. In this chapter we’ll look at a few tasks to get a feel for builders. We’ll then explore two techniques ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access