Class SignalsRegistry

java.lang.Object
com.vaadin.hilla.signals.internal.SignalsRegistry

public final class SignalsRegistry extends Object
A registry for signal instances and their client signal id mappings.
  • Method Details

    • register

      public void register(String clientSignalId, InternalSignal signal)
      Registers a signal instance and creates an association between the provided clientSignalId and signal.

      If the signal is already registered, signal instance registration is skipped. if the mapping between the provided clientSignalId and signal is already registered, the mapping is skipped, too.

      Parameters:
      clientSignalId - the client signal id, must not be null
      signal - the signal instance, must not be null
      Throws:
      NullPointerException - if clientSignalId or signal is null
    • get

      public InternalSignal get(String clientSignalId)
      Get a signal instance by the provided clientSignalId.

      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 - if clientSignalId is null
    • getBySignalId

      public InternalSignal getBySignalId(com.vaadin.signals.Id signalId)
      Get a signal instance by the provided signalId.

      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 - if signalId is null
    • contains

      public boolean contains(String clientSignalId)
      Checks if a mapping exists between a registered signal instance and the provided clientSignalId.
      Parameters:
      clientSignalId - the client signal id, must not be null
      Returns:
      true if the signal instance is registered, false otherwise
      Throws:
      NullPointerException - if signalId is null
    • unregister

      public void unregister(com.vaadin.signals.Id signalId)
      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 null
      Throws:
      NullPointerException - if signalId is null
    • removeClientSignalToSignalMapping

      public void removeClientSignalToSignalMapping(String clientSignalId)
      Removes only the mapping between a signal instance and the provided clientSignalId.
      Parameters:
      clientSignalId - the client signal id, must not be null
      Throws:
      NullPointerException - if clientSignalId 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

      public Set<String> getAllClientSignalIdsFor(com.vaadin.signals.Id signalId)
      Returns the Set of registered client signal ids for the provided signalId.
      Parameters:
      signalId - the signal id, must not be null
      Returns:
      the Set of registered client signal ids
      Throws:
      NullPointerException - if signalId is null