July 2013
Intermediate to advanced
370 pages
8h 27m
English
We’ve seen how to synthesize methods, and in this chapter we’ll see how to synthesize an entire class. Rather than creating explicit classes ahead of time, we can create classes on the fly, which gives us more flexibility. Delegation is better than inheritance, yet it has been hard to implement in Java. We’ll see how Groovy’s metaobject protocol (MOP) allows method delegation with only one line of code. We’ll wrap up this chapter by reviewing the MOP techniques we’ve seen in the preceding chapters.
Read now
Unlock full access