Class ImmutableVariableDocumentRecordValue

java.lang.Object
io.camunda.zeebe.protocol.record.value.ImmutableVariableDocumentRecordValue
All Implemented Interfaces:
JsonSerializable, RecordValue, RecordValueWithVariables, VariableDocumentRecordValue

@ParametersAreNonnullByDefault @Immutable public final class ImmutableVariableDocumentRecordValue extends Object implements VariableDocumentRecordValue
Immutable implementation of VariableDocumentRecordValue.

Use the builder to create immutable instances: ImmutableVariableDocumentRecordValue.builder().

  • Method Details

    • getVariables

      public Map<String,Object> getVariables()
      Specified by:
      getVariables in interface RecordValueWithVariables
      Returns:
      the variables of this record. Can be empty.
    • getScopeKey

      public long getScopeKey()
      Specified by:
      getScopeKey in interface VariableDocumentRecordValue
      Returns:
      the scope key associated with the variable document
    • getUpdateSemantics

      public VariableDocumentUpdateSemantic getUpdateSemantics()
      Specified by:
      getUpdateSemantics in interface VariableDocumentRecordValue
      Returns:
      the semantic of how this variable document is applied, see VariableDocumentUpdateSemantic
    • withVariables

      public final ImmutableVariableDocumentRecordValue withVariables(Map<String,? extends Object> entries)
      Copy the current immutable object by replacing the variables map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the variables map
      Returns:
      A modified copy of this object
    • withScopeKey

      public final ImmutableVariableDocumentRecordValue withScopeKey(long value)
      Copy the current immutable object by setting a value for the scopeKey attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for scopeKey
      Returns:
      A modified copy of the this object
    • withUpdateSemantics

      public final ImmutableVariableDocumentRecordValue withUpdateSemantics(VariableDocumentUpdateSemantic value)
      Copy the current immutable object by setting a value for the updateSemantics attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for updateSemantics (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableVariableDocumentRecordValue that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Returns a lazily computed hash code from attributes: variables, scopeKey, updateSemantics.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value VariableDocumentRecordValue with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      Creates an immutable copy of a VariableDocumentRecordValue value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable VariableDocumentRecordValue instance
    • builder

      Creates a builder for ImmutableVariableDocumentRecordValue.
       ImmutableVariableDocumentRecordValue.builder()
          .putVariable|putAllVariables(String => Object) // variables mappings
          .withScopeKey(long) // optional scopeKey
          .withUpdateSemantics(io.camunda.zeebe.protocol.record.value.VariableDocumentUpdateSemantic | null) // nullable updateSemantics
          .build();
       
      Returns:
      A new ImmutableVariableDocumentRecordValue builder