gh-pages / com.nextfaze.devfun.inject

Package com.nextfaze.devfun.inject

Types

Name Summary
AndroidInstanceProvider interface AndroidInstanceProvider : AndroidInstanceProviderInternal
CacheLevel enum class CacheLevel
Controls how aggressively the CompositeInstanceProvider caches the sources of class instances.
CapturingInstanceProvider class CapturingInstanceProvider<out T : Any> : InstanceProvider
An instance provider that requests an instance of a class from a captured lambda.
CompositeInstanceProvider interface CompositeInstanceProvider : ThrowingInstanceProvider, Composite<InstanceProvider>
Instance provider that delegates to other providers.
ConstructingInstanceProvider class ConstructingInstanceProvider : InstanceProvider
Provides objects via instance construction. Type must be annotated with Constructable.
InstanceProvider interface InstanceProvider
Provides object instances for one or more types.
KObjectInstanceProvider class KObjectInstanceProvider : InstanceProvider
Handles Kotlin object and companion object types.
ThrowingInstanceProvider interface ThrowingInstanceProvider : InstanceProvider
Same as InstanceProvider, but throws ClassInstanceNotFoundException instead of returning null.

Annotations

Name Summary
Constructable annotation class Constructable
Tag to allow classes to be instantiated when no other InstanceProvider was able to provide the class.

Exceptions

Name Summary
ClassInstanceNotFoundException class ClassInstanceNotFoundException : Exception
Exception thrown when attempting to provide a type that was not found from any InstanceProvider.
ConstructableException class ConstructableException : Exception
Thrown when ConstructingInstanceProvider fails to create a new instance of a class.

Extensions for External Classes

Name Summary
kotlin.reflect.KClass  

Functions

Name Summary
captureInstance fun <T : Any> captureInstance(instance: () -> T?): InstanceProvider
Utility function to capture an instance of an object.
createDefaultCompositeInstanceProvider fun createDefaultCompositeInstanceProvider(cacheLevel: CacheLevel = CacheLevel.AGGRESSIVE): CompositeInstanceProvider
Creates an instance provider that delegates to other providers.
singletonInstance fun <T : Any> singletonInstance(instance: () -> T?): InstanceProvider
Utility function to provide a single instance of some type.