Class TimestampedValue<T>

java.lang.Object
org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue<T>
Type Parameters:
T - The type encapsulated value

@PublicEvolving public class TimestampedValue<T> extends Object
Stores the value and the timestamp of the record.
  • Constructor Details

    • TimestampedValue

      public TimestampedValue(T value)
      Creates a new TimestampedValue. The record does not have a timestamp.
    • TimestampedValue

      public TimestampedValue(T value, long timestamp)
      Creates a new TimestampedValue wrapping the given value. The timestamp is set to the given timestamp.
      Parameters:
      value - The value to wrap in this TimestampedValue
      timestamp - The timestamp in milliseconds
  • Method Details

    • getValue

      public T getValue()
      Returns:
      The value wrapped in this TimestampedValue.
    • 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.
    • getStreamRecord

      public StreamRecord<T> getStreamRecord()
      Creates a StreamRecord from this TimestampedValue.
    • from

      public static <T> TimestampedValue<T> from(StreamRecord<T> streamRecord)
      Creates a TimestampedValue from given StreamRecord.
      Parameters:
      streamRecord - The StreamRecord object from which TimestampedValue is to be created.