Interface AiServiceListenerRegistrar
- All Known Implementing Classes:
DefaultAiServiceListenerRegistrar
public interface AiServiceListenerRegistrar
A registrar for registering
AiServiceListeners.-
Method Summary
Modifier and TypeMethodDescription<T extends AiServiceEvent>
voidfireEvent(T event) Fires the given event to all registeredAiServiceListeners.static AiServiceListenerRegistrarRetrieves an instance ofAiServiceListenerRegistrar.default voidregister(AiServiceListener<?>... listeners) Registers one or moreAiServiceListenerinstances to receiveAiServiceEventnotifications.<T extends AiServiceEvent>
voidregister(AiServiceListener<T> listener) Registers a listener to receiveAiServiceEventnotifications.default voidregister(Iterable<? extends AiServiceListener<?>> listeners) Registers a collection ofAiServiceListenerinstances to receiveAiServiceEventnotifications.default voidunregister(AiServiceListener<?>... listeners) Unregisters one or moreAiServiceListenerinstances to receiveAiServiceEventnotifications.<T extends AiServiceEvent>
voidunregister(AiServiceListener<T> listener) Unregisters a previously registeredAiServiceListener, stopping it from receiving furtherAiServiceEventnotifications.default voidunregister(Iterable<? extends AiServiceListener<?>> listeners) Unregisters a collection ofAiServiceListenerinstances to receiveAiServiceEventnotifications.
-
Method Details
-
register
Registers a listener to receiveAiServiceEventnotifications. -
register
Registers one or moreAiServiceListenerinstances to receiveAiServiceEventnotifications.- Parameters:
listeners- One or moreAiServiceListenerinstances to register. If null, no action will be taken.
-
register
Registers a collection ofAiServiceListenerinstances to receiveAiServiceEventnotifications. If the provided collection is null, no action is taken. Each listener in the collection is registered individually.- Parameters:
listeners- AnIterablecontaining instances ofAiServiceListenerto register. Each listener will be registered to receive notifications for its associated event type.
-
unregister
Unregisters a previously registeredAiServiceListener, stopping it from receiving furtherAiServiceEventnotifications. -
unregister
Unregisters one or moreAiServiceListenerinstances to receiveAiServiceEventnotifications.- Parameters:
listeners- One or moreAiServiceListenerinstances to unregister. If null, no action will be taken.
-
unregister
Unregisters a collection ofAiServiceListenerinstances to receiveAiServiceEventnotifications. If the provided collection is null, no action is taken. Each listener in the collection is unregistered individually.- Parameters:
listeners- AnIterablecontaining instances ofAiServiceListenerto unregister. Each listener will be registered to receive notifications for its associated event type.
-
fireEvent
Fires the given event to all registeredAiServiceListeners.- Type Parameters:
T- The type of the event, which must be a subtype ofAiServiceEvent.- Parameters:
event- The event to be fired to the listeners. Must not be null.
-
newInstance
Retrieves an instance ofAiServiceListenerRegistrar. This method first attempts to load an instance ofAiServiceListenerRegistrarusingServiceLoader. If no implementation is found, the default instance provided bynewInstance()is returned.
-