bindOrCreate

open fun <T> bindOrCreate(name: String, target: Class<T>): T

Bind the specified target Class using this binder's property sources or create a new instance of the specified target Class if the result of the binding is null.

Return

the bound or created object

Since

2.2.0

Parameters

name

the configuration property name to bind

target

the target class

<T>

the bound type

See also


open fun <T> bindOrCreate(name: String, target: Bindable<T>): T

Bind the specified target Bindable using this binder's property sources or create a new instance using the type of the Bindable if the result of the binding is null.

Return

the bound or created object

Since

2.2.0

Parameters

name

the configuration property name to bind

target

the target bindable

<T>

the bound type

See also


open fun <T> bindOrCreate(name: String, target: Bindable<T>, handler: BindHandler): T

Bind the specified target Bindable using this binder's property sources or create a new instance using the type of the Bindable if the result of the binding is null.

Return

the bound or created object

Since

2.2.0

Parameters

name

the configuration property name to bind

target

the target bindable

handler

the bind handler

<T>

the bound type

See also


open fun <T> bindOrCreate(name: ConfigurationPropertyName, target: Bindable<T>, handler: BindHandler): T

Bind the specified target Bindable using this binder's property sources or create a new instance using the type of the Bindable if the result of the binding is null.

Return

the bound or created object

Since

2.2.0

Parameters

name

the configuration property name to bind

target

the target bindable

handler

the bind handler (may be null)

<T>

the bound or created type