ServiceSupplier

class ServiceSupplier<T : Any> @JvmOverloads constructor(val primaryType: KClass<T>, val name: String = defaultName(primaryType), val additionalTypes: Set<KClass<in T>> = emptySet(), val isPrimary: Boolean = false, val isLazy: Boolean = false, val priority: Int = 0, val annotations: List<Annotation> = emptyList(), val supplier: (BContext) -> T)(source)

Represents the attributes and initializer of a given service type.

Note: The annotations passed will not be readable using standard reflection, they are only read when functions like ServiceContainer.findAnnotationOnService or ServiceContainer.getServiceNamesForAnnotation are used.

See also

Constructors

Link copied to clipboard
constructor(primaryType: Class<T>, name: String = defaultName(primaryType.kotlin), additionalTypes: Set<Class<in T>> = emptySet(), isPrimary: Boolean = false, isLazy: Boolean = false, priority: Int = 0, annotations: List<Annotation> = emptyList(), supplier: (BContext) -> T)

Constructs a ServiceSupplier.

constructor(primaryType: KClass<T>, name: String = defaultName(primaryType), additionalTypes: Set<KClass<in T>> = emptySet(), isPrimary: Boolean = false, isLazy: Boolean = false, priority: Int = 0, annotations: List<Annotation> = emptyList(), supplier: (BContext) -> T)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Additional types this service can be retrieved as

Link copied to clipboard

Annotations which should be tied to this service

Link copied to clipboard
val isLazy: Boolean = false

Whether this service should be initialized only when requested

Link copied to clipboard
val isPrimary: Boolean = false

Whether this service should be a primary service

Link copied to clipboard

The name to register the service as

Link copied to clipboard

The type as which the service will be registered as

Link copied to clipboard
val priority: Int = 0

The priority of this service

Link copied to clipboard
val supplier: (BContext) -> T

The function supplying the service

Functions

Link copied to clipboard
open override fun toString(): String