O'Reilly logo

Groovy for Domain-specific Languages - Second Edition by Fergal Dearle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

BuilderSupport

Under the hood, all of Groovy's own Builders are implemented using the invokeMethod or methodMissing methods and delegate techniques that we have described in the previous section. We can choose to start creating our own builder classes by using these features alone. Perhaps the biggest challenge when creating a builder with these features alone is that the MOP concepts of pretended methods and delegate handling don't fit well with the task at hand—namely, the construction of complex objects. It would be nice to have APIs that reflected the task at hand in a better way.

Thankfully, the complexities of managing invokeMethod or methodMissing calls and figuring out who the delegate should be, are encapsulated into the builder support ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required