title: grails how to iterate through params and set values
body: <p>Is there anybody who has written a universal action for iterating through all params values and setting these values on an object?</p>
  
  <p>I want to write something like this:</p>
  
  <pre><code>def updateSomeObject = {obj-&gt;
      for (def key : params.keySet()) {
          if (obj.hasProperty(key) != null) {
              def strValue = params[key]
              obj[key] = strValue
      }
  }
  </code></pre>
  
  <p>but this works only for String values. In my case there are one to one associations, so it has to work with objects too.</p>
  
  <p>I would like not to set properties (their names) to object, which values are null.</p>