registerServiceSupplier

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

Registers a supplier which gets loaded in the same manner as annotated service classes/factories.

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.

Parameters

primaryType

The type as which the service will be registered as

name

The name to register the service as

additionalTypes

Additional types this service can be retrieved as

isPrimary

Whether this service should be a primary service

isLazy

Whether this service should be initialized only when requested

priority

The priority of this service

annotations

Annotations which should be tied to this service

supplier

The function supplying the service