SimpleServiceProvider
Simple implementation of ServiceProvider using thread-safe ConcurrentHashMap for storage. Provides basic service registration and retrieval functionality with support for both type-based and name-based lookups. Supports subtype matching for type-based lookups.
This implementation is suitable for most use cases requiring a lightweight, thread-safe service provider.
Properties
Functions
Creates a shallow copy of this service provider. The copy contains references to the same service instances but in separate maps.
Copies all registered services from this provider to the target provider. Iterates through all named services and registers them with the target provider.
Retrieves a required service using reified type information, throwing an exception if not found. This is a convenience extension that automatically uses the reified type for lookup.
Retrieves a required service by Java class, throwing an exception if not found. This method guarantees that a service is returned or an exception is thrown.
Retrieves a required service by name, throwing an exception if not found. This method guarantees that a service is returned or an exception is thrown.
Retrieves a required service by Kotlin type, throwing an exception if not found. This method guarantees that a service is returned or an exception is thrown.
Retrieves a service by its registered name. Performs a direct lookup in the named services map.
Retrieves a service by its Kotlin type. First tries exact type match, then falls back to subtype matching if no exact match is found.
Retrieves a service using reified type information. This is a convenience extension that automatically uses the reified type for lookup.