getService

inline fun <S : Any> ServiceProvider.getService(): S?

Retrieves a service using reified type information. This is a convenience extension that automatically uses the reified type for lookup.

Return

the service instance of type S, or null if not found

val provider = SimpleServiceProvider()
val service: MyServiceInterface? = provider.getService()

Type Parameters

S

the type of service to retrieve