Interface Record<S,V>

Type Parameters:
V - the type backing the Record.
All Known Subinterfaces:
ByteBufferRecord, ByteRecord, MapRecord<S,K,V>, ObjectRecord<S,V>, StringRecord

public interface Record<S,V>
A single entry in the stream consisting of the entry-id and the actual entry-value (typically a collection of field/value pairs).
Since:
2.2
Author:
Christoph Strobl
See Also:
  • Method Details

    • getStream

      @Nullable S getStream()
      The id of the stream (aka the key in Redis).
      Returns:
      can be null.
    • getRequiredStream

      default S getRequiredStream()
      The id of the stream (aka the key in Redis).
      Returns:
      can be null.
      Throws:
      IllegalStateException - if the stream is null.
      Since:
      3.0
    • getId

      RecordId getId()
      The id of the entry inside the stream.
      Returns:
      never null.
    • getValue

      V getValue()
      Returns:
      the actual content. Never null.
    • of

      static <S, K, V> MapRecord<S,K,V> of(Map<K,V> map)
      Create a new MapRecord instance backed by the given Map holding field/value pairs.
      You may want to use the builders available via StreamRecords.
      Type Parameters:
      K - the key type of the given Map.
      V - the value type of the given Map.
      Parameters:
      map - the raw map.
      Returns:
      new instance of MapRecord.
    • of

      static <S, V> ObjectRecord<S,V> of(V value)
      Create a new ObjectRecord instance backed by the given value. The value may be a simple type, like String or a complex one.
      You may want to use the builders available via StreamRecords.
      Type Parameters:
      V - the type of the backing value.
      Parameters:
      value - the value to persist.
      Returns:
      new instance of MapRecord.
    • withId

      Record<S,V> withId(RecordId id)
      Create a new instance of Record with the given RecordId.
      Parameters:
      id - must not be null.
      Returns:
      new instance of Record.
    • withStreamKey

      <SK> Record<SK,V> withStreamKey(SK key)
      Create a new instance of Record with the given key to store the record at.
      Type Parameters:
      SK -
      Parameters:
      key - the Redis key identifying the stream.
      Returns:
      new instance of Record.