Package guru.zoroark.tegral.di.extensions.factory

Types

Link copied to clipboard
class FactoryDeclaration<T : Any>(actualIdentifier: Identifier<T>, makerIdentifier: Identifier<InjectableFactory<T>>) : ResolvableDeclaration<T>

A declaration that declares a resolver for elements generated by a factory.

Link copied to clipboard
class FactoryResolver<T : Any>(makerIdentifier: Identifier<InjectableFactory<T>>) : IdentifierResolver<T>

An IdentifierResolver that resolves elements generated by a factory.

Link copied to clipboard
fun interface InjectableFactory<T : Any>

An injectable component whose job is to create components of the same type repeatably.

Link copied to clipboard
class SynchronizedLazyPropertyWrapper<T, V : Any>(wrappedProperty: ReadOnlyProperty<T, V>) : ReadOnlyProperty<T, V>

Similar to lazy { } but uses a property instead of a lambda for building. Inspired by the SYNCHRONIZED lazy implementation.

Functions

Link copied to clipboard
inline fun <R : Any, T : Any> InjectionScope.factory(): ReadOnlyProperty<R, T>

DSL for injecting factory-made objects. Usage is factory from scope.

Link copied to clipboard
inline fun <T : Any> ContextBuilderDsl.putFactory(noinline block: (Any) -> T)

Allows to put a factory within the module or environment.

Link copied to clipboard
infix inline fun <T, V, R : Any> ReadOnlyProperty<T, V>.wrapIn(crossinline mapper: (V) -> R): SynchronizedLazyPropertyWrapper<T, R>

Utility function that wraps a given property using the given wrapper. This is useful when you want to transform the output of a property in some way.

Link copied to clipboard
infix inline fun <T, V, R : Any> ReadOnlyProperty<T, V>.wrapInWithThisRef(crossinline mapper: (T, V) -> R): SynchronizedLazyPropertyWrapper<T, R>

Identical to wrapIn, but also gives you access to the object the property is owned by in the mapper lambda.

Link copied to clipboard
inline fun <T, V, R> WrappedReadOnlyProperty(original: ReadOnlyProperty<T, V>, crossinline mapper: (T, V) -> R): ReadOnlyProperty<T, R>

Wraps a property and maps its result using the given mapper.