Class SignalsRegistry
java.lang.Object
com.vaadin.hilla.signals.core.registry.SignalsRegistry
A registry for signal instances and their client signal id mappings.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a mapping exists between a registered signal instance and the providedclientSignalId.Signal<?>Get a signal instance by the providedclientSignalId.getAllClientSignalIdsFor(UUID signalId) Returns the Set of registered client signal ids for the providedsignalId.intReturns the number of registered unique mappings between client signal ids and the signal instances.Signal<?>getBySignalId(UUID signalId) Get a signal instance by the providedsignalId.booleanisEmpty()Checks if the registry is empty.voidRegisters a signal instance and creates an association between the providedclientSignalIdandsignal.voidremoveClientSignalToSignalMapping(String clientSignalId) Removes only the mapping between a signal instance and the providedclientSignalId.intsize()Returns the number of registered signal instances.voidunregister(UUID signalId) Removes a signal instance by the providedsignalId.
-
Method Details
-
register
Registers a signal instance and creates an association between the providedclientSignalIdandsignal.If the signal is already registered, signal instance registration is skipped. if the mapping between the provided
clientSignalIdandsignalis already registered, the mapping is skipped, too.- Parameters:
clientSignalId- the client signal id, must not be nullsignal- the signal instance, must not be null- Throws:
NullPointerException- ifclientSignalIdorsignalis null
-
get
Get a signal instance by the providedclientSignalId.- Parameters:
clientSignalId- the client signal id, must not be null- Returns:
- the signal instance, or null if no signal is found for the
provided
clientSignalId - Throws:
NullPointerException- ifclientSignalIdis null
-
getBySignalId
Get a signal instance by the providedsignalId.- Parameters:
signalId- the signal id, must not be null- Returns:
- the signal instance, or null if no signal is found for the
provided
signalId - Throws:
NullPointerException- ifsignalIdis null
-
contains
Checks if a mapping exists between a registered signal instance and the providedclientSignalId.- Parameters:
clientSignalId- the client signal id, must not be null- Returns:
- true if the signal instance is registered, false otherwise
- Throws:
NullPointerException- ifsignalIdis null
-
unregister
Removes a signal instance by the providedsignalId.It also removes all the possible associated client signals, too.
- Parameters:
signalId- the signal id, must not be null- Throws:
NullPointerException- ifsignalIdis null
-
removeClientSignalToSignalMapping
Removes only the mapping between a signal instance and the providedclientSignalId.- Parameters:
clientSignalId- the client signal id, must not be null- Throws:
NullPointerException- ifclientSignalIdis null
-
isEmpty
public boolean isEmpty()Checks if the registry is empty.- Returns:
- true if the registry is empty, false otherwise
-
size
public int size()Returns the number of registered signal instances.- Returns:
- the number of registered signal instances
-
getAllClientSubscriptionsSize
public int getAllClientSubscriptionsSize()Returns the number of registered unique mappings between client signal ids and the signal instances.- Returns:
- the number of registered client signals
-
getAllClientSignalIdsFor
Returns the Set of registered client signal ids for the providedsignalId.- Parameters:
signalId- the signal id, must not be null- Returns:
- the Set of registered client signal ids
- Throws:
NullPointerException- ifsignalIdis null
-