Class ImmutableVariableRecordValue

java.lang.Object
io.camunda.zeebe.protocol.record.value.ImmutableVariableRecordValue
All Implemented Interfaces:
JsonSerializable, RecordValue, ProcessInstanceRelated, VariableRecordValue

@ParametersAreNonnullByDefault @Immutable public final class ImmutableVariableRecordValue extends Object implements VariableRecordValue
Immutable implementation of VariableRecordValue.

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

  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface VariableRecordValue
      Returns:
      the name of the variable.
    • getValue

      public String getValue()
      Specified by:
      getValue in interface VariableRecordValue
      Returns:
      the value of the variable as JSON string.
    • getScopeKey

      public long getScopeKey()
      Specified by:
      getScopeKey in interface VariableRecordValue
      Returns:
      the key of the scope the variable belongs to.
    • getProcessInstanceKey

      public long getProcessInstanceKey()
      Specified by:
      getProcessInstanceKey in interface ProcessInstanceRelated
      Specified by:
      getProcessInstanceKey in interface VariableRecordValue
      Returns:
      the key of the process instance the variable belongs to
    • getProcessDefinitionKey

      public long getProcessDefinitionKey()
      Specified by:
      getProcessDefinitionKey in interface VariableRecordValue
      Returns:
      the key of the process the variable belongs to
    • getBpmnProcessId

      public String getBpmnProcessId()
      Specified by:
      getBpmnProcessId in interface VariableRecordValue
      Returns:
      the BPMN process id this process instance belongs to.
    • withName

      public final ImmutableVariableRecordValue withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name (can be null)
      Returns:
      A modified copy of the this object
    • withValue

      public final ImmutableVariableRecordValue withValue(String value)
      Copy the current immutable object by setting a value for the value attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for value (can be null)
      Returns:
      A modified copy of the this object
    • withScopeKey

      public final ImmutableVariableRecordValue 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
    • withProcessInstanceKey

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

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

      public final ImmutableVariableRecordValue withBpmnProcessId(String value)
      Copy the current immutable object by setting a value for the bpmnProcessId attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bpmnProcessId (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 ImmutableVariableRecordValue 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: name, value, scopeKey, processInstanceKey, processDefinitionKey, bpmnProcessId.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableVariableRecordValue copyOf(VariableRecordValue instance)
      Creates an immutable copy of a VariableRecordValue 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 VariableRecordValue instance
    • builder

      public static ImmutableVariableRecordValue.Builder builder()
      Creates a builder for ImmutableVariableRecordValue.
       ImmutableVariableRecordValue.builder()
          .withName(String | null) // nullable name
          .withValue(String | null) // nullable value
          .withScopeKey(long) // optional scopeKey
          .withProcessInstanceKey(long) // optional processInstanceKey
          .withProcessDefinitionKey(long) // optional processDefinitionKey
          .withBpmnProcessId(String | null) // nullable bpmnProcessId
          .build();
       
      Returns:
      A new ImmutableVariableRecordValue builder