K - the type of the keyV - the type of the valuepublic class Record<K,V> extends Object
This class is used by application willing to configure the written record. The couple key/value is used for, respectively, the record's key and record's value. Instances are used as message's payload.
Both key and value can be null. Instances of this class are immutable.
If the application needs to configure more aspect of the record, use the
OutgoingCloudEventMetadata.
If the attached metadata configures the key, the key provided by the record is overidden.
| Modifier and Type | Method and Description |
|---|---|
K |
key() |
static <K,V> Record<K,V> |
of(K key,
V value)
Creates a new record.
|
V |
value() |
<T> Record<T,V> |
withKey(T key)
Creates a new instance of
Record with given key and the value from the current record. |
<T> Record<K,T> |
withValue(T value)
Creates a new instance of
Record with the key from the current record and the new value. |
public static <K,V> Record<K,V> of(K key, V value)
K - the type of the keyV - the type of the valuekey - the key, can be nullvalue - the value, can be nullpublic K key()
nullpublic V value()
nullpublic <T> Record<T,V> withKey(T key)
Record with given key and the value from the current record.T - the type of the new keykey - the new key, can be nullCopyright © 2018–2021 SmallRye. All rights reserved.