android-beans / rocks.frieler.android.beans / DeclarativeBeanConfiguration / bean

bean

fun <T : Any> bean(beanDefinition: BeanDefinition<T>): Unit

Defines a bean through a BeanDefinition.

This is mainly a wrapper around addBeanDefinition to provide a declarative API to be used with a factory-function for the BeanDefinition

Parameters

beanDefinition - the BeanDefinition

See Also

addBeanDefinition

inline fun <reified T : Any> bean(name: String? = null, noinline definition: BeansProvider.() -> T): Unit

Defines a bean, optionally with the specified name.

Parameters

name - the bean's name (optional)

definition - the definition to construct the bean

@JvmOverloads fun <T : Any> bean(name: String? = null, type: Class<T>, definition: BeansProvider.() -> T): Unit
@JvmOverloads fun <T : Any> bean(name: String? = null, type: Class<T>, definition: () -> T): Unit

Defines a bean (optionally with the specified name) of a Java type.

This version of bean() is intended for Java interoperability.

Parameters

name - the bean's name (optional)

type - the bean's type

definition - the definition to construct the bean