gradle
8.4

# getByName

abstract fun getByName(name: String): T(source)

Locates an object by name, failing if there is no such object.

#### Return

The object with the given name. Never returns null.

#### Parameters

name

The object name

#### Throws

UnknownDomainObjectException

when there is no such object in this collection.

abstract fun getByName(name: String, configureClosure: Closure): T(source)

Locates an object by name, failing if there is no such object. The given configure closure is executed against the object before it is returned from this method. The object is passed to the closure as its delegate.

#### Return

The object with the given name, after the configure closure has been applied to it. Never returns null.

#### Parameters

name

The object name

configureClosure

The closure to use to configure the object.

#### Throws

UnknownDomainObjectException

when there is no such object in this collection.

abstract fun getByName(name: String, configureAction: Action<out Any>): T(source)

Locates an object by name, failing if there is no such object. The given configure action is executed against the object before it is returned from this method.

#### Return

The object with the given name, after the configure action has been applied to it. Never returns null.

#### Parameters

name

The object name

configureAction

The action to use to configure the object.

#### Throws

UnknownDomainObjectException

when there is no such object in this collection.