Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
def builder = new ObjectGraphBuilder()
// uncomment the following line if running this script with GroovyConsole
//builder.classloader = getClass().classLoader
builder.classNameResolver = "com.acme"

def acme = builder.company( name: 'ACME' ){
   3.times {
      employee( id: it.toString(), name: 'Drone ${it}' )
   }
}

assertNotNullassert acme != null
assert acme.employees.size() == 3

...

Its worth mentioning that you can not cannot modify the properties of a referenced bean.

...