title: Groovy - Efficiently map CSV data into object's constructor
body: <p>I have an object that is composed of complex objects like this</p>
  
  <pre><code>class ObjectA {   
    int cool
    Object1 b   
    Object2 b 
  }
  
  
  class Object1 {   
    int go
    String do 
  }
  </code></pre>
  
  <p>The requirement is to load CSV data from a file and assign it to an instance of the above object. I am using Grails CSV plugin and I'm able to retrieve CSV data from a file. Each row is a MAP containing values for a unique object instance. The map is in the following format:</p>
  
  <pre><code>cool: 1, object1go: 3, object1do: 'hello', object2hm: 'world'
  </code></pre>
  
  <p>My question is how can I efficiently pass "<code>object1go</code>" and "<code>object1do</code>" to data member (i.e. <code>Object1</code>) inside <code>ObjectA</code> class without having to do much parsing.</p>