Class 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 Detail

      • 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 Detail

      • 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.
      • 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.