V
- query value typepublic static interface TimeSeries.Event<V> extends TimeSeries.EventMetadata
Two instances are equal
if and only if they
have identical attributes. Typically two Event instances that have the
same sequence number will be equal, but this may not be true if the event
has changed on the server – see Changes to a time series made
outside the API in the TimeSeries
documentation.
Modifier and Type | Method and Description |
---|---|
boolean |
isEditEvent()
Return whether this is an edit event.
|
TimeSeries.EventMetadata |
originalEvent()
If this is an edit event, returns the metadata of the original event
that this event replaces; otherwise returns this event.
|
V |
value()
The value associated with the event.
|
<T> TimeSeries.Event<T> |
withValue(T newValue)
Clone this event with a different value.
|
author, sequence, timestamp
V value()
TimeSeries.EventMetadata originalEvent()
The result is always the metadata of an original event, never that of an edit event.
this
, this is not an edit event;
otherwise, the sequence number of the event replaced by this
edit eventboolean isEditEvent()
x.isEditEvent()
is equivalent to
x.originalEvent() != x
.
<T> TimeSeries.Event<T> withValue(T newValue)
This method is useful when further transformation of the received value is needed, but the application wishes to preserve other event attributes. For example, if a Bytes value is received which the session wishes to interpret as JSON, it can do the following.
Event<JSON> transformToJSON(Event<Bytes> bytesEvent) { JSON json = Diffusion.dataTypes().json().readValue(bytesEvent.value(); return bytesEvent.withValue(json); }
All attributes other than the value will be copied from this event. The result will only equal this event if newValue equals this event's value.
T
- the new value typeCopyright © 2024 DiffusionData Ltd. All Rights Reserved.