public interface ChangeServiceProviderEvent extends Event
ServiceManager
.
This event is fired after the replacement has taken place. Calling
ServiceManager.provideUnchecked(Class)
with the service will return
getNewProviderRegistration()
.
This can occur when a provider is registered for a service for the first time, or when the provider for a service is replaced.
Modifier and Type | Method and Description |
---|---|
default Object |
getNewProvider()
Gets the new provider being registered.
|
ProviderRegistration<?> |
getNewProviderRegistration()
Gets the new provider registration for the service.
|
Optional<ProviderRegistration<?>> |
getPreviousProviderRegistration()
Gets the previous provider registration for the service, if available.
|
default Class<?> |
getService()
Gets the service that a provider is being registered for.
|
default boolean |
isReplacement()
Gets whether a previous provider existed, which was replaced by the new
provider.
|
getCause, getContext, getSource
Optional<ProviderRegistration<?>> getPreviousProviderRegistration()
If a provider is being registered for the first time for the service,
this will return Optional.empty()
.
If this is present, then it will always have the same
provider as getNewProviderRegistration()
.
ProviderRegistration<?> getNewProviderRegistration()
default boolean isReplacement()
default Class<?> getService()
default Object getNewProvider()