Interface AiServiceListenerRegistrar
- All Known Implementing Classes:
DefaultAiServiceListenerRegistrar
public interface AiServiceListenerRegistrar
A registrar for registering
AiServiceListener
s.-
Method Summary
Modifier and TypeMethodDescription<T extends AiServiceEvent>
voidfireEvent
(T event) Fires the given event to all registeredAiServiceListener
s.static AiServiceListenerRegistrar
Retrieves an instance ofAiServiceListenerRegistrar
.default void
register
(AiServiceListener<?>... listeners) Registers one or moreAiServiceListener
instances to receiveAiServiceEvent
notifications.<T extends AiServiceEvent>
voidregister
(AiServiceListener<T> listener) Registers a listener to receiveAiServiceEvent
notifications.default void
register
(Iterable<? extends AiServiceListener<?>> listeners) Registers a collection ofAiServiceListener
instances to receiveAiServiceEvent
notifications.default void
unregister
(AiServiceListener<?>... listeners) Unregisters one or moreAiServiceListener
instances to receiveAiServiceEvent
notifications.<T extends AiServiceEvent>
voidunregister
(AiServiceListener<T> listener) Unregisters a previously registeredAiServiceListener
, stopping it from receiving furtherAiServiceEvent
notifications.default void
unregister
(Iterable<? extends AiServiceListener<?>> listeners) Unregisters a collection ofAiServiceListener
instances to receiveAiServiceEvent
notifications.
-
Method Details
-
register
Registers a listener to receiveAiServiceEvent
notifications. -
register
Registers one or moreAiServiceListener
instances to receiveAiServiceEvent
notifications.- Parameters:
listeners
- One or moreAiServiceListener
instances to register. If null, no action will be taken.
-
register
Registers a collection ofAiServiceListener
instances to receiveAiServiceEvent
notifications. If the provided collection is null, no action is taken. Each listener in the collection is registered individually.- Parameters:
listeners
- AnIterable
containing instances ofAiServiceListener
to register. Each listener will be registered to receive notifications for its associated event type.
-
unregister
Unregisters a previously registeredAiServiceListener
, stopping it from receiving furtherAiServiceEvent
notifications. -
unregister
Unregisters one or moreAiServiceListener
instances to receiveAiServiceEvent
notifications.- Parameters:
listeners
- One or moreAiServiceListener
instances to unregister. If null, no action will be taken.
-
unregister
Unregisters a collection ofAiServiceListener
instances to receiveAiServiceEvent
notifications. If the provided collection is null, no action is taken. Each listener in the collection is unregistered individually.- Parameters:
listeners
- AnIterable
containing instances ofAiServiceListener
to unregister. Each listener will be registered to receive notifications for its associated event type.
-
fireEvent
Fires the given event to all registeredAiServiceListener
s.- 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 ofAiServiceListenerRegistrar
usingServiceLoader
. If no implementation is found, the default instance provided bynewInstance()
is returned.
-