title: Groovy: Add references to methods in a property to a parent object
body: <p>Say I have a class like this:</p>
  
  <pre><code>class Foo {
    def doFoo() {
      println "foo"
    }
  }
  </code></pre>
  
  <p>And another like this:</p>
  
  <pre><code>class Bar {
    def doBar() {
      println "bar"
    }
  }
  </code></pre>
  
  <p>And one more that looks like this:</p>
  
  <pre><code>class Baz {
    Foo foo = new Foo()
    Bar bar = new Bar()
  }
  </code></pre>
  
  <p>With that example, what would it take to be able to use it like this:</p>
  
  <pre><code>Baz baz = new Baz()
  baz.doFoo()
  baz.doBar()
  </code></pre>
  
  <p>where the <code>doFoo</code> and <code>doBar</code> method calls simply delegate to the defined versions in their respective objects? Is there a way to do this with some kind of metaprogramming, or am I stuck defining each method individually as a wrapper?</p>