Instantiator

open class Instantiator<T>

Simple factory used to instantiate objects by injecting available parameters.

Author

Phillip Webb

Scott Frederick

Since

2.4.0

Parameters

<T>

the type to instantiate

Constructors

Link copied to clipboard
constructor(type: Class<out Any>, availableParameters: Consumer<Instantiator.AvailableParameters>)
Create a new Instantiator instance for the given type.
constructor(type: Class<out Any>, availableParameters: Consumer<Instantiator.AvailableParameters>, failureHandler: Instantiator.FailureHandler)
Create a new Instantiator instance for the given type.

Types

Link copied to clipboard
Callback used to register available parameters.
Link copied to clipboard
interface FailureHandler
Strategy for handling a failure that occurs when instantiating a type.

Functions

Link copied to clipboard
open fun <A> getArg(type: Class<A>): A
Get an injectable argument instance for the given type.
Link copied to clipboard
open fun instantiate(name: String): T
open fun instantiate(names: Collection<String>): List<T>
open fun instantiate(classLoader: ClassLoader, name: String): T
open fun instantiate(classLoader: ClassLoader, names: Collection<String>): List<T>
Instantiate the given set of class name, injecting constructor arguments as necessary.
Link copied to clipboard
open fun instantiateType(type: Class<out Any>): T
Instantiate the given class, injecting constructor arguments as necessary.
Link copied to clipboard
open fun instantiateTypes(types: Collection<Class<out Any>>): List<T>
Instantiate the given set of classes, injecting constructor arguments as necessary.