com.vaadin.hilla.signals.core.registry.
Class SignalsRegistry
A registry for signal instances and their client signal id mappings.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if a mapping exists between a registered signal instance and the provided
clientSignalId
.Signal<?>
Get a signal instance by the provided
clientSignalId
.getAllClientSignalIdsFor
(UUID signalId) Returns the Set of registered client signal ids for the provided
signalId
.int
Returns the number of registered unique mappings between client signal ids and the signal instances.
Signal<?>
getBySignalId
(UUID signalId) Get a signal instance by the provided
signalId
.boolean
isEmpty()
Checks if the registry is empty.
void
Registers a signal instance and creates an association between the provided
clientSignalId
andsignal
.void
removeClientSignalToSignalMapping
(String clientSignalId) Removes only the mapping between a signal instance and the provided
clientSignalId
.int
size()
Returns the number of registered signal instances.
void
unregister
(UUID signalId) Removes a signal instance by the provided
signalId
.
-
Method Details
-
register
Registers a signal instance and creates an association between the provided
clientSignalId
andsignal
.If the signal is already registered, signal instance registration is skipped. if the mapping between the provided
clientSignalId
andsignal
is already registered, the mapping is skipped, too.Parameters:
clientSignalId
- the client signal id, must not be nullsignal
- the signal instance, must not be nullThrows:
NullPointerException
- ifclientSignalId
orsignal
is null -
get
Get a signal instance by the provided
clientSignalId
.Parameters:
clientSignalId
- the client signal id, must not be nullReturns:
the signal instance, or null if no signal is found for the provided
clientSignalId
Throws:
NullPointerException
- ifclientSignalId
is null -
getBySignalId
Get a signal instance by the provided
signalId
.Parameters:
signalId
- the signal id, must not be nullReturns:
the signal instance, or null if no signal is found for the provided
signalId
Throws:
NullPointerException
- ifsignalId
is null -
contains
Checks if a mapping exists between a registered signal instance and the provided
clientSignalId
.Parameters:
clientSignalId
- the client signal id, must not be nullReturns:
true if the signal instance is registered, false otherwise
Throws:
NullPointerException
- ifsignalId
is null -
unregister
Removes a signal instance by the provided
signalId
.It also removes all the possible associated client signals, too.
Parameters:
signalId
- the signal id, must not be nullThrows:
NullPointerException
- ifsignalId
is null -
removeClientSignalToSignalMapping
Removes only the mapping between a signal instance and the provided
clientSignalId
.Parameters:
clientSignalId
- the client signal id, must not be nullThrows:
NullPointerException
- ifclientSignalId
is 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 provided
signalId
.Parameters:
signalId
- the signal id, must not be nullReturns:
the Set of registered client signal ids
Throws:
NullPointerException
- ifsignalId
is null
-