Class ImmutableClockRecordValue

java.lang.Object
io.camunda.zeebe.protocol.record.value.ImmutableClockRecordValue
All Implemented Interfaces:
JsonSerializable, RecordValue, ClockRecordValue

public final class ImmutableClockRecordValue extends Object implements ClockRecordValue
Immutable implementation of ClockRecordValue.

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

  • Method Details

    • getTime

      public long getTime()
      Returns the value of this clock modification, if any.
      1. If the associated intent is a pin, then the time is a Unix timestamp as epoch milliseconds
      2. If the associated intent is an offset, then time would be the duration in milliseconds
      3. If the associated intent is a reset, then this value has no meaning, and will be 0
      Specified by:
      getTime in interface ClockRecordValue
    • withTime

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

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableClockRecordValue 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: time.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableClockRecordValue.Builder builder()
      Creates a builder for ImmutableClockRecordValue.
       ImmutableClockRecordValue.builder()
          .withTime(long) // optional time
          .build();
       
      Returns:
      A new ImmutableClockRecordValue builder