koin-core / org.koin.core.definition / BeanDefinition

BeanDefinition

class BeanDefinition<T>

Koin bean definition main structure to make definition in Koin

Parameters

qualifier -

primaryType -

Author
Arnaud Giuliani

Constructors

<init>

BeanDefinition(qualifier: Qualifier? = null, primaryType: KClass<*>)

Koin bean definition main structure to make definition in Koin

Properties

definition

lateinit var definition: Definition<T>

instance

var instance: DefinitionInstance<T>?

kind

lateinit var kind: Kind

onClose

var onClose: OnCloseCallback<T>?

onRelease

var onRelease: OnReleaseCallback<T>?

options

var options: Options

primaryType

val primaryType: KClass<*>

properties

var properties: Properties

qualifier

val qualifier: Qualifier?

scopeName

var scopeName: Qualifier?

secondaryTypes

var secondaryTypes: ArrayList<KClass<*>>

Functions

close

fun close(): Unit

createInstanceHolder

fun createInstanceHolder(): Unit

Create the associated Instance Holder

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

isKind

fun isKind(kind: Kind): Boolean

Tells if the definition is this Kind

resolveInstance

fun <T> resolveInstance(context: InstanceContext): T

Resolve instance

toString

fun toString(): String

Extension Functions

bind

infix fun <T> BeanDefinition<T>.bind(clazz: KClass<*>): BeanDefinition<T>

Add a compatible type to match for definition

binds

infix fun BeanDefinition<*>.binds(classes: Array<KClass<*>>): BeanDefinition<*>

Add compatible types to match for definition

onClose

infix fun <T> BeanDefinition<T>.onClose(onClose: OnCloseCallback<T>): BeanDefinition<T>

Callback when closing instance from registry (called just before final close)

onRelease

infix fun <T> BeanDefinition<T>.onRelease(onRelease: OnReleaseCallback<T>): BeanDefinition<T>

Callback when releasing instance