abstract fun configure(object: Any, configureClosure: Closure<Any>): Any
Configures an object via a closure, with the closure's delegate set to the supplied object. This way you don't have to specify the context of a configuration statement multiple times.
Instead of:
MyType myType = new MyType() myType.doThis() myType.doThat()
you can do:
MyType myType = configure(new MyType()) { doThis() doThat() }
The object being configured is also passed to the closure as a parameter, so you can access it explicitly if required:
configure(someObj) { obj -> obj.doThis() }
object
- The object to configure
configureClosure
- The closure with configure statements
Return
The configured object
abstract fun configure(objects: MutableIterable<*>, configureClosure: Closure<Any>): MutableIterable<*>
Configures a collection of objects via a closure. This is equivalent to calling #configure(Object, * groovy.lang.Closure)
for each of the given objects.
objects
- The objects to configure
configureClosure
- The closure with configure statements
Return
The configured objects.
abstract fun <T : Any> configure(objects: MutableIterable<T>, configureAction: Action<in T>): MutableIterable<T>
Configures a collection of objects via an action.
objects
- The objects to configure
configureAction
- The action to apply to each object
Return
The configured objects.