android-beans / rocks.frieler.android.beans / BeansOfTypeConsumer

BeansOfTypeConsumer

class BeansOfTypeConsumer<Type : Any> : BeanPostProcessor

BeanPostProcessor to consume all beans of a certain type (including all its subtypes).

A common use-case is to collect all beans implementing a certain interface and inject them lazily into another bean.

Parameters

Author
Christopher Frieler

Constructors

<init>

BeansOfTypeConsumer(type: Class<Type>, consumer: Consumer<Type>)BeansOfTypeConsumer(type: KClass<Type>, consumer: (Type) -> Unit)

BeanPostProcessor to consume all beans of a certain type (including all its subtypes).

Functions

postProcessBean

fun <T : Any> postProcessBean(name: String, bean: T): T

Allows to post-process beans of a BeanRegistry.