android-beans / rocks.frieler.android.beans / BeanDefinition

BeanDefinition

open class BeanDefinition<T : Any>

A BeanDefinition defines a bean through its type, a function to create the bean and optionally with a name.

Author
Christopher Frieler

Constructors

<init>

BeanDefinition(name: String? = null, type: KClass<T>, creator: (BeansProvider) -> T)

A BeanDefinition defines a bean through its type, a function to create the bean and optionally with a name.

Functions

canProduce

open fun canProduce(type: KClass<*>): Boolean

Indicates whether this BeanDefinition will produce a bean of the given type (or a subtype).

getName

fun getName(): String?

Returns the name for the defined bean or null if no name was specified explicitly.

getType

fun getType(): KClass<T>

Returns the type of the defined bean.

produceBean

fun produceBean(dependencyProvider: BeansProvider): T

Produces the bean by invoking the creator function.

Inheritors

ScopedBeanDefinition

class ScopedBeanDefinition<F : ScopedFactoryBean<*>, T : Any> : BeanDefinition<F>

Special BeanDefinition for ScopedFactoryBeans that is also aware of the type of bean produced by the factory-bean.