Service Provider
@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION ] )
This annotation is used to identify which service(s) the annotated element provides an instance for.
If no services are explicitly provided, the plugin will attempt to find all supertypes of the element that have the Service annotation.
This annotation can be applied to the following targets:
AnnotationTarget.CLASS: Only applicable to objects
AnnotationTarget.PROPERTY: Only applicable to immutable non-suspend properties with getter or initializer
AnnotationTarget.FUNCTION: Only applicable to non-suspend functions without arguments and without receiver
Usage:
@ServiceProvider(SimpleService::class)
object SimpleServiceImpl : SimpleService {
override fun saySomethingSweet() { ... }
}
Content copied to clipboard