1 package org.oxerr.huobi.rest.domain;
2
3 public enum Type {
4
5 BUY("do_buy", "买入"), SELL("do_sell", "卖出");
6
7 public static Type toType(String typeString) {
8 for (Type type : Type.values()) {
9 if (type.type.equals(typeString)) {
10 return type;
11 }
12 }
13
14 throw new IllegalArgumentException("Unexpected type: " + typeString);
15 }
16
17 public static Type delegationToType(String delegationTypeString) {
18 for (Type type : Type.values()) {
19 if (type.delegationType.equals(delegationTypeString)) {
20 return type;
21 }
22 }
23
24 throw new IllegalArgumentException("Unexpected delegation type: "
25 + delegationTypeString);
26 }
27
28 private String type;
29
30 private String delegationType;
31
32 Type(String type, String delegationType) {
33 this.type = type;
34 this.delegationType = delegationType;
35 }
36
37
38
39
40 public String getDelegationType() {
41 return delegationType;
42 }
43
44
45
46
47 @Override
48 public String toString() {
49 return type;
50 }
51
52 }