# getByName

inline fun <T : Any> ERROR CLASS: Symbol not found for ExtensionContainer.getByName(name: String): ERROR CLASS: Cannot infer argument for type parameter R(source)

Looks for the extension of a given name and casts it to the expected type T.

If none found it will throw an UnknownDomainObjectException. If the extension is found but cannot be cast to the expected type it will throw an IllegalStateException.

#### Return

extension, never null

#### Parameters

name

extension name

#### Throws

UnknownDomainObjectException

When the given extension is not found.

IllegalStateException

When the given extension cannot be cast to the expected type.

inline fun <T : Any> ERROR CLASS: Symbol not found for NamedDomainObjectCollection<out kotlin/Any>.getByName(name: String): ERROR CLASS: Cannot infer argument for type parameter R(source)

Locates an object by name and casts it to the expected type T.

If an object with the given name is not found, UnknownDomainObjectException is thrown. If the object is found but cannot be cast to the expected type T, IllegalArgumentException is thrown.

#### Return

the object, never null

#### Parameters

name

object name

#### Throws

UnknownDomainObjectException

When the given object is not found.

IllegalArgumentException

When the given object cannot be cast to the expected type.

fun <T : Any> ERROR CLASS: Symbol not found for NamedDomainObjectCollection<out kotlin/Any>.getByName(name: String, type: KClass<T>): T(source)

Locates an object by name and casts it to the expected type.

If an object with the given name is not found, UnknownDomainObjectException is thrown. If the object is found but cannot be cast to the expected type, IllegalArgumentException is thrown.

#### Return

the object, never null

#### Parameters

name

object name

type

expected type

#### Throws

UnknownDomainObjectException

When the given object is not found.

IllegalArgumentException

When the given object cannot be cast to the expected type.

fun <T : Any> ERROR CLASS: Symbol not found for NamedDomainObjectCollection<out kotlin/Any>.getByName(name: String, type: KClass<T>, configure: T.() -> Unit): T(source)

Locates an object by name and casts it to the expected type then configures it.

If an object with the given name is not found, UnknownDomainObjectException is thrown. If the object is found but cannot be cast to the expected type, IllegalArgumentException is thrown.

#### Return

the object, never null

#### Parameters

name

object name

configure

configuration action to apply to the object before returning it

#### Throws

UnknownDomainObjectException

When the given object is not found.

IllegalArgumentException

When the given object cannot be cast to the expected type.

inline fun <T : Any> ERROR CLASS: Symbol not found for NamedDomainObjectCollection<out kotlin/Any>.getByName(name: String, configure: T.() -> Unit): ERROR CLASS: Cannot infer argument for type parameter T(source)

Locates an object by name and casts it to the expected type T then configures it.

If an object with the given name is not found, UnknownDomainObjectException is thrown. If the object is found but cannot be cast to the expected type T, IllegalArgumentException is thrown.

#### Return

the object, never null

#### Parameters

name

object name

configure

configuration action to apply to the object before returning it

#### Throws

UnknownDomainObjectException

When the given object is not found.

IllegalArgumentException

When the given object cannot be cast to the expected type.