内容纲要
public enum StatusCodeEnum {
  WAITING_TO_PROCESS("200", "waiting_to_process"),
  WAITING_FOR_ACTION("601", "waiting_for_action"),
  SHORTAGE("602", "shortage"),
  WAVE_ASSIGNED("300", "wave_assigned"),
  HANDOVERED("500", "handovered"),
  CANCELLED("600", "cancelled");

  private static Map<String, String> map = new HashMap<>();

  static {
    for (StatusCodeEnum code : StatusCodeEnum.values()) {
      map.put(code.getStatus_code(), code.getStatus());
    }
  }

  private String status_code;
  private String status;

  StatusCodeEnum(String status_code, String status) {
    this.status_code = status_code;
    this.status = status;
  }

  public static String getByStatusCode(String statucCode) {
    return map.get(statucCode);
  }

  public String getStatus_code() {
    return status_code;
  }

  public void setStatus_code(String status_code) {
    this.status_code = status_code;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }
}
Spread the knowledge