android-beans / rocks.frieler.android.beans / BeansProvider / lookUpBean

lookUpBean

open fun <T : Any> lookUpBean(name: String, type: KClass<T>): T

Looks up the bean with the given name and type.

If no bean with that name is registered or the registered bean is not assignable to the required type, a NoSuchBeanException is thrown.

Parameters

name - the name of the desired bean

type - the type of the desired bean

Parameters

Return
the named bean

open fun <T : Any> lookUpBean(name: String, type: Class<T>): T

Looks up the bean with the given name and Java type.

If no bean with that name is registered or the registered bean is not assignable to the required type, a NoSuchBeanException is thrown.

Parameters

name - the name of the desired bean

type - the type of the desired bean

Parameters

Return
the named bean or null

open fun <T : Any> lookUpBean(type: KClass<T>): T

Looks up a bean of the given type.

If no bean is assignable to the required type, a NoSuchBeanException is thrown. If multiple beans are assignable to the required type, the first match is returned.

Parameters

type - the type of the desired bean

Parameters

Return
a bean of the given type

open fun <T : Any> lookUpBean(type: Class<T>): T

Looks up a bean of the given Java type.

If no bean is assignable to the required type, a NoSuchBeanException is thrown. If multiple beans are assignable to the required type, the first match is returned.

Parameters

type - the type of the desired bean

Parameters

Return
a bean of the given type