Class StreamRecord<T>
java.lang.Object
org.apache.flink.streaming.runtime.streamrecord.StreamElement
org.apache.flink.streaming.runtime.streamrecord.StreamRecord<T>
- Type Parameters:
T- The type encapsulated with the stream record.
One value in a data stream. This stores the value and an optional associated timestamp.
-
Constructor Summary
ConstructorsConstructorDescriptionStreamRecord(T value) Creates a new StreamRecord.StreamRecord(T value, long timestamp) Creates a new StreamRecord wrapping the given value. -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of this stream record.voidcopyTo(T valueCopy, StreamRecord<T> target) Copies this record into the new stream record.booleanvoidlongReturns the timestamp associated with this stream value in milliseconds.getValue()Returns the value wrapped in this stream value.inthashCode()booleanChecks whether this record has a timestamp.<X> StreamRecord<X>replace(X element) Replace the currently stored value by the given new value.<X> StreamRecord<X>replace(X value, long timestamp) Replace the currently stored value by the given new value and the currently stored timestamp with the new timestamp.voidsetTimestamp(long timestamp) toString()Methods inherited from class org.apache.flink.streaming.runtime.streamrecord.StreamElement
asLatencyMarker, asRecord, asRecordAttributes, asWatermark, asWatermarkStatus, isLatencyMarker, isRecord, isRecordAttributes, isWatermark, isWatermarkStatus
-
Constructor Details
-
StreamRecord
Creates a new StreamRecord. The record does not have a timestamp. -
StreamRecord
Creates a new StreamRecord wrapping the given value. The timestamp is set to the given timestamp.- Parameters:
value- The value to wrap in thisStreamRecordtimestamp- The timestamp in milliseconds
-
-
Method Details
-
getValue
Returns the value wrapped in this stream value. -
getTimestamp
public long getTimestamp()Returns the timestamp associated with this stream value in milliseconds. -
hasTimestamp
public boolean hasTimestamp()Checks whether this record has a timestamp.- Returns:
- True if the record has a timestamp, false if not.
-
replace
Replace the currently stored value by the given new value. This returns a StreamElement with the generic type parameter that matches the new value while keeping the old timestamp.- Parameters:
element- Element to set in this stream value- Returns:
- Returns the StreamElement with replaced value
-
replace
Replace the currently stored value by the given new value and the currently stored timestamp with the new timestamp. This returns a StreamElement with the generic type parameter that matches the new value.- Parameters:
value- The new value to wrap in this StreamRecordtimestamp- The new timestamp in milliseconds- Returns:
- Returns the StreamElement with replaced value
-
setTimestamp
public void setTimestamp(long timestamp) -
eraseTimestamp
public void eraseTimestamp() -
copy
Creates a copy of this stream record. Uses the copied value as the value for the new record, i.e., only copies timestamp fields. -
copyTo
Copies this record into the new stream record. Uses the copied value as the value for the new record, i.e., only copies timestamp fields. -
equals
-
hashCode
public int hashCode() -
toString
-