Package com.vaadin.hilla.signals
Class Signal<T>
java.lang.Object
com.vaadin.hilla.signals.Signal<T>
- Direct Known Subclasses:
ValueSignal
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract com.fasterxml.jackson.databind.node.ObjectNodeCreates a snapshot event reflecting the current state of the signal.booleangetId()Returns the signal UUID.Returns the signal value type.inthashCode()protected abstract booleanprocessEvent(com.fasterxml.jackson.databind.node.ObjectNode event) Processes the event and updates the signal value if needed.voidsubmit(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.
-
Constructor Details
-
Signal
-
-
Method Details
-
getId
Returns the signal UUID.- Returns:
- the id
-
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:
trueif the event was successfully processed and the signal value was updated,falseotherwise.
-
equals
-
hashCode
public int hashCode()
-