Package io.camunda.zeebe.protocol.record
Class ImmutableRecord.Builder<T extends RecordValue>
java.lang.Object
io.camunda.zeebe.protocol.record.ImmutableRecord.Builder<T>
- Enclosing class:
- ImmutableRecord<T extends RecordValue>
@NotThreadSafe
public static final class ImmutableRecord.Builder<T extends RecordValue>
extends Object
Builds instances of type
ImmutableRecord.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newImmutableRecord.clear()Clear the builder to the initial state.final ImmutableRecord.Builder<T>Fill a builder with attribute values from the providedRecordinstance.final ImmutableRecord.Builder<T>withBrokerVersion(String brokerVersion) Initializes the value for thebrokerVersionattribute.final ImmutableRecord.Builder<T>withIntent(Intent intent) Initializes the value for theintentattribute.final ImmutableRecord.Builder<T>withKey(long key) Initializes the value for thekeyattribute.final ImmutableRecord.Builder<T>withPartitionId(int partitionId) Initializes the value for thepartitionIdattribute.final ImmutableRecord.Builder<T>withPosition(long position) Initializes the value for thepositionattribute.final ImmutableRecord.Builder<T>withRecordType(RecordType recordType) Initializes the value for therecordTypeattribute.final ImmutableRecord.Builder<T>withRejectionReason(String rejectionReason) Initializes the value for therejectionReasonattribute.final ImmutableRecord.Builder<T>withRejectionType(RejectionType rejectionType) Initializes the value for therejectionTypeattribute.final ImmutableRecord.Builder<T>withSourceRecordPosition(long sourceRecordPosition) Initializes the value for thesourceRecordPositionattribute.final ImmutableRecord.Builder<T>withTimestamp(long timestamp) Initializes the value for thetimestampattribute.final ImmutableRecord.Builder<T>Initializes the value for thevalueattribute.final ImmutableRecord.Builder<T>withValueType(ValueType valueType) Initializes the value for thevalueTypeattribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedRecordinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
withPosition
Initializes the value for thepositionattribute.- Parameters:
position- The value for position- Returns:
thisbuilder for use in a chained invocation
-
withSourceRecordPosition
Initializes the value for thesourceRecordPositionattribute.- Parameters:
sourceRecordPosition- The value for sourceRecordPosition- Returns:
thisbuilder for use in a chained invocation
-
withKey
Initializes the value for thekeyattribute.- Parameters:
key- The value for key- Returns:
thisbuilder for use in a chained invocation
-
withTimestamp
Initializes the value for thetimestampattribute.- Parameters:
timestamp- The value for timestamp- Returns:
thisbuilder for use in a chained invocation
-
withIntent
Initializes the value for theintentattribute.- Parameters:
intent- The value for intent (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withPartitionId
Initializes the value for thepartitionIdattribute.- Parameters:
partitionId- The value for partitionId- Returns:
thisbuilder for use in a chained invocation
-
withRecordType
Initializes the value for therecordTypeattribute.- Parameters:
recordType- The value for recordType (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withRejectionType
Initializes the value for therejectionTypeattribute.- Parameters:
rejectionType- The value for rejectionType (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withRejectionReason
Initializes the value for therejectionReasonattribute.- Parameters:
rejectionReason- The value for rejectionReason (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withBrokerVersion
Initializes the value for thebrokerVersionattribute.- Parameters:
brokerVersion- The value for brokerVersion (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withValueType
Initializes the value for thevalueTypeattribute.- Parameters:
valueType- The value for valueType (can benull)- Returns:
thisbuilder for use in a chained invocation
-
withValue
Initializes the value for thevalueattribute.- Parameters:
value- The value for value (can benull)- Returns:
thisbuilder for use in a chained invocation
-
clear
Clear the builder to the initial state.- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableRecord.- Returns:
- An immutable instance of Record
- Throws:
IllegalStateException- if any required attributes are missing
-