Interface IErrorCode


public interface IErrorCode
Provides an error code that identifies the type of message.

Implementations of this interface are expected to be immutable.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the error code value.
    default String
    Get a combination of the error code family and value.
    Get the error code prefix, which indicates what type of error it is.
    static IErrorCode
    of(String prefix, int code)
    Create a new error code with the provided prefix and code value.
  • Method Details

    • of

      @NonNull static IErrorCode of(@NonNull String prefix, int code)
      Create a new error code with the provided prefix and code value.
      Parameters:
      prefix - the error code prefix
      code - the error code value
      Returns:
      a new error code instance
    • getPrefix

      @NonNull String getPrefix()
      Get the error code prefix, which indicates what type of error it is.
      Returns:
      the error code prefix
    • getCode

      int getCode()
      Get the error code value.
      Returns:
      the error code value
    • getCodeAsString

      @NonNull default String getCodeAsString()
      Get a combination of the error code family and value.
      Returns:
      the full error code.