Enum Class PlatformResultCode

java.lang.Object
java.lang.Enum<PlatformResultCode>
io.github.theword.queqiao.core.platform.PlatformResultCode
All Implemented Interfaces:
Serializable, Comparable<PlatformResultCode>, Constable

public enum PlatformResultCode extends Enum<PlatformResultCode>
平台操作的结果码

表达"平台侧发生了什么",与协议层的 HTTP-like 状态码完全无关: 这里不出现 400 / 404 / 500 之类的概念,也不带任何 int / string 序列化字段。 把结果码翻译成协议状态是 Api 层的职责。

不依赖 Protocol:本枚举不得引用 ProtocolException、Response 或任何协议类型。

Since:
0.7.0
  • Enum Constant Details

    • SUCCESS

      public static final PlatformResultCode SUCCESS
      操作成功
    • PLAYER_NOT_FOUND

      public static final PlatformResultCode PLAYER_NOT_FOUND
      目标玩家不存在

      由平台在查找阶段判定;与"请求里没给目标"(INVALID_ARGUMENT)是两回事。

    • INVALID_ARGUMENT

      public static final PlatformResultCode INVALID_ARGUMENT
      参数不合法

      例如命令内容为空。属于调用方的问题。

    • UNSUPPORTED

      public static final PlatformResultCode UNSUPPORTED
      平台不支持该能力

      典型场景:平台没有覆盖标题 / ActionBar 等可选原语。

    • FAILED

      public static final PlatformResultCode FAILED
      其它失败

      平台侧执行时发生的、无法归入以上分类的错误。

  • Method Details

    • values

      public static PlatformResultCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PlatformResultCode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null