Using Groovy 2.0 (beta)....
Got a bean that has both simple (i.e. primitive) and complex (i.e. other beans as children) properties. Want to recursively copy properties from a bean instance into a new bean and apply function calls per property. For example, a property might contain an expression (i.e. something representing a value that hasn't been evaluated) and during the "clone"/"copy" phase I want to apply an evaluation so the new bean gets a concrete value.
New to Groovy and my stomach tells there is a simple way to handle this. Beans are written in Groovy.
For example:
Source.name: '${xpath:applicationServer/name}'
Source.type: 'Server'
Source.create.name: 'com.bea:Name=${domain.name},Type=Domain'
....
the name, type fields are simple part of the Source class while create is complex (nested property). When copying I want to evaluate the variables (i.e. ${xpath:...}, ${domain.name} based on a context, commons configuration setup). Note the copying is done between objects of the same class.
Seen stuff like: Copy Groovy class properties where an intersection between different classes is done but the construction of nested properties isn't recursive.