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>
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> putAllAuthorizations(Map<String, ? extends Object> entries) Put all mappings from the specified map as entries toauthorizationsmap.final ImmutableRecord.Builder<T> putAuthorization(String key, Object value) Put one entry to theauthorizationsmap.final ImmutableRecord.Builder<T> putAuthorization(Map.Entry<String, ? extends Object> entry) Put one entry to theauthorizationsmap.final ImmutableRecord.Builder<T> withAuthorizations(Map<String, ? extends Object> entries) Sets or replaces all mappings from the specified map as entries for theauthorizationsmap.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> withOperationReference(long operationReference) Initializes the value for theoperationReferenceattribute.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> withRecordVersion(int recordVersion) Initializes the value for therecordVersionattribute.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. Collection elements and entries will be added, not replaced.- 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
-
putAuthorization
Put one entry to theauthorizationsmap.- Parameters:
key- The key in the authorizations mapvalue- The associated value in the authorizations map- Returns:
thisbuilder for use in a chained invocation
-
putAuthorization
Put one entry to theauthorizationsmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
withAuthorizations
Sets or replaces all mappings from the specified map as entries for theauthorizationsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the authorizations map- Returns:
thisbuilder for use in a chained invocation
-
putAllAuthorizations
Put all mappings from the specified map as entries toauthorizationsmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the authorizations map- Returns:
thisbuilder for use in a chained invocation
-
withRecordVersion
Initializes the value for therecordVersionattribute.- Parameters:
recordVersion- The value for recordVersion- 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
-
withOperationReference
Initializes the value for theoperationReferenceattribute.- Parameters:
operationReference- The value for operationReference- 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
-