# getByName

abstract fun getByName(name: String): T

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

This operation is eager and will cause the returned element to be realized.

#### 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

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.

This operation is eager and will cause the returned element to be realized.

#### 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<in T>): T

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.

This operation is eager and will cause the returned element to be realized.

#### Return

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

#### Since

3.1

#### 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.