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

BeansProvider

interface BeansProvider

Interface for classes that provide the beans of an application.

Beans are simple Java objects, that get registered with a name and can be looked up either by their name or type to inject them as dependencies (DI).

Author
Christopher Frieler

Functions

lookUpBean

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

Looks up the bean with the given name and type.

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

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

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

Looks up a bean of the given type.

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

Looks up a bean of the given Java type.

lookUpBeans

abstract fun <T : Any> lookUpBeans(type: KClass<T>): List<T>

Looks up all beans of the given type in the BeanRegistry of this application.

open fun <T : Any> lookUpBeans(type: Class<T>): List<T>

Looks up all beans of the given Java type in the BeanRegistry of this application.

lookUpOptionalBean

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

Looks up the bean with the given name and type.

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

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

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

Looks up a bean of the given type.

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

Looks up a bean of the given Java type.

Inheritors

BeanConfigurationsBeansCollector

class BeanConfigurationsBeansCollector : BeansProvider

The BeanConfigurationsBeansCollector collects the beans defined by BeanConfigurations in a BeanRegistry.

BeanRegistry

class BeanRegistry : BeansProvider

BeansProvider that holds and provides beans which were explicitly registered before.