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

lookUpOptionalBean

abstract fun <T : Any> lookUpOptionalBean(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, null is returned.

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> lookUpOptionalBean(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, null is returned.

Parameters

name - the name of the desired bean

type - the type of the desired bean

Parameters

Return
the named bean or null

abstract fun <T : Any> lookUpOptionalBean(type: KClass<T>): T?

Looks up a bean of the given type.

If no bean is assignable to the required type, null is returned. 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 or null

open fun <T : Any> lookUpOptionalBean(type: Class<T>): T?

Looks up a bean of the given Java type.

If no bean is assignable to the required type, null is returned. 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 or null