android-beans / rocks.frieler.android.beans / BeanRegistry

BeanRegistry

class BeanRegistry : HierarchicalBeansProvider

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

The BeanRegistry supports the singleton and prototype scopes by default.

BeanRegistry is also a HierarchicalBeansProvider, so it supports a parent to inherit beans from.

Author
Christopher Frieler

Functions

addBeanScope

fun addBeanScope(scopedFactoryBeanHandler: ScopedFactoryBeanHandler): Unit

Adds a bean-scope expressed by the given ScopedFactoryBeanHandler to this BeanRegistry.

lookUpLocalBeans

fun <T : Any> lookUpLocalBeans(type: KClass<T>): List<T>

Looks up all beans of the given type solely locally, i.e. not in the parent.

lookUpOptionalLocalBean

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

Looks up the bean with the given name and type locally, i.e. solely in this BeansProvider, not in the parent, following the same contract as BeansProvider.lookUpOptionalBean.

fun <T : Any> lookUpOptionalLocalBean(type: KClass<T>): T?

Looks up the bean with the given type locally, i.e. solely in this BeansProvider, not in the parent, following the same contract as BeansProvider.lookUpOptionalBean.

registerBean

fun registerBean(bean: Any): String

Registers the bean with a generated name at this BeanRegistry and returns this name.

fun registerBean(name: String, bean: Any): Unit

Registers the bean with the given name at this BeanRegistry.

Inherited Functions

lookUpBeans

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

Looks up all beans of the given type locally and in the parent.

lookUpOptionalBean

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

Looks up the bean with the given name and type.

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

Looks up the bean with the given type.