Class Services
java.lang.Object
net.kyori.adventure.util.Services
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <P> Optional<P> Deprecated, for removal: This API element is subject to removal in a future version.static <P> Optional<P> service(ServiceLoader<P> loader, Class<P> type) Collects a service from the loader.static <P> Set<P> Deprecated, for removal: This API element is subject to removal in a future version.This method creates theServiceLoaderin the API module and is not compatible with JPMS service lookup.static <P> Set<P> services(ServiceLoader<? extends P> loader, Class<? extends P> type) Collects all providers for a certain service and initializes them.static <P> Optional<P> serviceWithFallback(Class<P> type) Deprecated, for removal: This API element is subject to removal in a future version.This method creates theServiceLoaderin the API module and is not compatible with JPMS service lookup.static <P> Optional<P> serviceWithFallback(ServiceLoader<P> loader, Class<P> type) Collects the services.
-
Method Details
-
service
@Deprecated(since="5.1.0", forRemoval=true) @ScheduledForRemoval(inVersion="6.0.0") public static <P> Optional<P> service(Class<P> type) Deprecated, for removal: This API element is subject to removal in a future version.This method creates theServiceLoaderin the API module and is not compatible with JPMS service lookup. Useservice(ServiceLoader, Class)instead.Locates a service.- Type Parameters:
P- the service type- Parameters:
type- the service type- Returns:
- a service, or
Optional.empty() - Since:
- 4.8.0
-
service
Collects a service from the loader.- Type Parameters:
P- the service type- Parameters:
loader- the service loadertype- the service type- Returns:
- a service, or
Optional.empty() - Since:
- 5.1.0
-
serviceWithFallback
@Deprecated(since="5.1.0", forRemoval=true) @ScheduledForRemoval(inVersion="6.0.0") public static <P> Optional<P> serviceWithFallback(Class<P> type) Deprecated, for removal: This API element is subject to removal in a future version.This method creates theServiceLoaderin the API module and is not compatible with JPMS service lookup. UseserviceWithFallback(ServiceLoader, Class)instead.Locates a service.If multiple services of this type exist, the first non-fallback service will be returned.
- Type Parameters:
P- the service type- Parameters:
type- the service type- Returns:
- a service, or
Optional.empty() - Since:
- 4.14.0
- See Also:
-
serviceWithFallback
Collects the services.If multiple services of this type exist, the first non-fallback service will be returned.
- Type Parameters:
P- the service type- Parameters:
loader- the service loadertype- the service type- Returns:
- a service, or
Optional.empty() - Since:
- 5.1.0
- See Also:
-
services
@Deprecated(since="5.1.0", forRemoval=true) @ScheduledForRemoval(inVersion="6.0.0") public static <P> Set<P> services(Class<? extends P> clazz) Deprecated, for removal: This API element is subject to removal in a future version.This method creates theServiceLoaderin the API module and is not compatible with JPMS service lookup. Useservices(ServiceLoader, Class)instead.Locates all providers for a certain service and initializes them.- Type Parameters:
P- the service interface type- Parameters:
clazz- the service interface- Returns:
- an unmodifiable set of all known providers of the service
- Since:
- 4.17.0
-
services
Collects all providers for a certain service and initializes them.- Type Parameters:
P- the service interface type- Parameters:
loader- the service loadertype- the service type- Returns:
- an unmodifiable set of all known providers of the service
- Since:
- 5.1.0
-
ServiceLoaderin the API module and is not compatible with JPMS service lookup.