Record Class OdysseyResult

java.lang.Object
java.lang.Record
io.confluent.kafka.odyssey.OdysseyResult

public record OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent) extends Record
Result of any Odyssey operation (validation, association creation, etc.). This class encapsulates the outcome of interactions with the Odyssey/Schema Registry service, including success/failure status, error codes, and messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent)
    Creates an instance of a OdysseyResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the errorCode record component.
    Returns the value of the errorMessage record component.
    failure(int errorCode, short kafkaErrorCode, String errorMessage)
    Creates a failure result.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the isIdempotent record component.
    boolean
    Returns the value of the isSuccess record component.
    short
    Returns the value of the kafkaErrorCode record component.
    Creates a success result.
    success(boolean isIdempotent)
    Creates a success result with idempotent flag.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • OdysseyResult

      public OdysseyResult(boolean isSuccess, int errorCode, short kafkaErrorCode, Optional<String> errorMessage, boolean isIdempotent)
      Creates an instance of a OdysseyResult record class.
      Parameters:
      isSuccess - the value for the isSuccess record component
      errorCode - the value for the errorCode record component
      kafkaErrorCode - the value for the kafkaErrorCode record component
      errorMessage - the value for the errorMessage record component
      isIdempotent - the value for the isIdempotent record component
  • Method Details

    • success

      public static OdysseyResult success()
      Creates a success result.
      Returns:
      a successful OdysseyResult
    • success

      public static OdysseyResult success(boolean isIdempotent)
      Creates a success result with idempotent flag.
      Parameters:
      isIdempotent - whether this was an idempotent success (e.g., association already existed)
      Returns:
      a successful OdysseyResult
    • failure

      public static OdysseyResult failure(int errorCode, short kafkaErrorCode, String errorMessage)
      Creates a failure result.
      Parameters:
      errorCode - the Odyssey/Schema Registry error code
      kafkaErrorCode - the Kafka protocol error code
      errorMessage - the error message
      Returns:
      a failed OdysseyResult
    • errorMessage

      public Optional<String> errorMessage()
      Returns the value of the errorMessage record component.
      Returns:
      the value of the errorMessage record component
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • isSuccess

      public boolean isSuccess()
      Returns the value of the isSuccess record component.
      Returns:
      the value of the isSuccess record component
    • errorCode

      public int errorCode()
      Returns the value of the errorCode record component.
      Returns:
      the value of the errorCode record component
    • kafkaErrorCode

      public short kafkaErrorCode()
      Returns the value of the kafkaErrorCode record component.
      Returns:
      the value of the kafkaErrorCode record component
    • isIdempotent

      public boolean isIdempotent()
      Returns the value of the isIdempotent record component.
      Returns:
      the value of the isIdempotent record component