getByName

inline fun <T : Any> ExtensionContainer.getByName(name: String): T(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.

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


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.

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


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.

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


fun <T : Any> NamedDomainObjectCollection<out 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.

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


inline fun <T : Any> NamedDomainObjectCollection<out Any>.getByName(name: String, configure: T.() -> Unit): 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.

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