Class ImmutableErrorRecordValue

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

public final class ImmutableErrorRecordValue extends Object implements ErrorRecordValue
Immutable implementation of ErrorRecordValue.

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

  • Method Details

    • getExceptionMessage

      public String getExceptionMessage()
      Specified by:
      getExceptionMessage in interface ErrorRecordValue
      Returns:
      the exception message, which causes this error record.
    • getStacktrace

      public String getStacktrace()
      Specified by:
      getStacktrace in interface ErrorRecordValue
      Returns:
      the stacktrace, which belongs to the exception
    • getErrorEventPosition

      public long getErrorEventPosition()
      Specified by:
      getErrorEventPosition in interface ErrorRecordValue
      Returns:
      the position of the event, which causes this error
    • getProcessInstanceKey

      public long getProcessInstanceKey()
      Specified by:
      getProcessInstanceKey in interface ErrorRecordValue
      Returns:
      the process instance key, which is related to the failed event. If the event is not process instance related, then this will return -1
    • withExceptionMessage

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

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

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

      public final ImmutableErrorRecordValue 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
    • equals

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

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

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

      public static ImmutableErrorRecordValue.Builder builder()
      Creates a builder for ImmutableErrorRecordValue.
       ImmutableErrorRecordValue.builder()
          .withExceptionMessage(String | null) // nullable exceptionMessage
          .withStacktrace(String | null) // nullable stacktrace
          .withErrorEventPosition(long) // optional errorEventPosition
          .withProcessInstanceKey(long) // optional processInstanceKey
          .build();
       
      Returns:
      A new ImmutableErrorRecordValue builder