Class Signal<T>

java.lang.Object
com.vaadin.hilla.signals.Signal<T>
Direct Known Subclasses:
ValueSignal

public abstract class Signal<T> extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Signal(Class<T> valueType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract com.fasterxml.jackson.databind.node.ObjectNode
    Creates a snapshot event reflecting the current state of the signal.
    boolean
     
    Returns the signal UUID.
    Returns the signal value type.
    int
     
    protected abstract boolean
    processEvent(com.fasterxml.jackson.databind.node.ObjectNode event)
    Processes the event and updates the signal value if needed.
    void
    submit(com.fasterxml.jackson.databind.node.ObjectNode event)
    Submits an event to the signal and notifies subscribers about the change of the signal value.
    reactor.core.publisher.Flux<com.fasterxml.jackson.databind.node.ObjectNode>
    Subscribes to the signal.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Signal

      public Signal(Class<T> valueType)
  • Method Details

    • getId

      public UUID getId()
      Returns the signal UUID.
      Returns:
      the id
    • getValueType

      public Class<T> getValueType()
      Returns the signal value type.
      Returns:
      the value type
    • subscribe

      public reactor.core.publisher.Flux<com.fasterxml.jackson.databind.node.ObjectNode> subscribe()
      Subscribes to the signal.
      Returns:
      a Flux of JSON events
    • submit

      public void submit(com.fasterxml.jackson.databind.node.ObjectNode event)
      Submits an event to the signal and notifies subscribers about the change of the signal value.
      Parameters:
      event - the event to submit
    • createSnapshotEvent

      protected abstract com.fasterxml.jackson.databind.node.ObjectNode createSnapshotEvent()
      Creates a snapshot event reflecting the current state of the signal.
      Returns:
      the snapshot event
    • processEvent

      protected abstract boolean processEvent(com.fasterxml.jackson.databind.node.ObjectNode event)
      Processes the event and updates the signal value if needed. Note that this method is not thread-safe and should be called from a synchronized context.
      Parameters:
      event - the event to process
      Returns:
      true if the event was successfully processed and the signal value was updated, false otherwise.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object