gh-pages / com.nextfaze.devfun.inject / ConstructingInstanceProvider
ConstructingInstanceProvider
class ConstructingInstanceProvider : InstanceProvider (source)
Provides objects via instance construction. Type must be annotated with Constructable.
Only supports objects with a single constructor. Constructor arguments will fetched using param rootInstanceProvider.
If Constructable.singleton is true or type is annotated @Singleton then only one instance will be created and shared.
Parameters
rootInstanceProvider - An instance provider used to fetch constructor args. If null, then self (this) is used
requireConstructable - Flag indicating if a type must be Constructable to be instantiable
Internal Visible for testing - use at your own risk.
Constructors
| Name | Summary |
|---|---|
| <init> | ConstructingInstanceProvider(rootInstanceProvider: InstanceProvider? = null, requireConstructable: Boolean = true)Provides objects via instance construction. Type must be annotated with Constructable. |
Properties
| Name | Summary |
|---|---|
| requireConstructable | var requireConstructable: BooleanFlag indicating if a type must be Constructable to be instantiable |
Functions
| Name | Summary |
|---|---|
| get | fun <T : Any> get(clazz: KClass<out T>): T?Try to get an instance of some clazz. fun <T : Any> get(clazz: KClass<out T>, requireConstructable: Boolean): T? |
| toString | fun toString(): String |