提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
子连接连接方式 |
|
6 |
*/ |
|
7 |
public enum EM_TRANSMIT_PROXY_MODE { |
|
8 |
/** |
|
9 |
/< 本地代理 |
|
10 |
*/ |
|
11 |
EM_TRANSMIT_PROXY_MODE_LOCAL(1,"/< 本地代理"), |
|
12 |
/** |
|
13 |
/< 级联代理 |
|
14 |
*/ |
|
15 |
EM_TRANSMIT_PROXY_MODE_CASCADE(2,"/< 级联代理"); |
|
16 |
|
|
17 |
private int value; |
|
18 |
|
|
19 |
private String note; |
|
20 |
|
|
21 |
public String getNote() { |
|
22 |
return note; |
|
23 |
} |
|
24 |
|
|
25 |
public int getValue() { |
|
26 |
return value; |
|
27 |
} |
|
28 |
|
|
29 |
EM_TRANSMIT_PROXY_MODE(int givenValue, String note) { |
|
30 |
this.value = givenValue; |
|
31 |
this.note = note; |
|
32 |
} |
|
33 |
|
|
34 |
public static String getNoteByValue(int givenValue) { |
|
35 |
for (EM_TRANSMIT_PROXY_MODE enumType : EM_TRANSMIT_PROXY_MODE.values()) { |
|
36 |
if (givenValue == enumType.getValue()) { |
|
37 |
return enumType.getNote(); |
|
38 |
} |
|
39 |
} |
|
40 |
return null; |
|
41 |
} |
|
42 |
|
|
43 |
public static int getValueByNote(String givenNote) { |
|
44 |
for (EM_TRANSMIT_PROXY_MODE enumType : EM_TRANSMIT_PROXY_MODE.values()) { |
|
45 |
if (givenNote.equals(enumType.getNote())) { |
|
46 |
return enumType.getValue(); |
|
47 |
} |
|
48 |
} |
|
49 |
return 0; |
|
50 |
} |
|
51 |
|
|
52 |
public static EM_TRANSMIT_PROXY_MODE getEnum(int value) { |
|
53 |
for (EM_TRANSMIT_PROXY_MODE e : EM_TRANSMIT_PROXY_MODE.values()) { |
|
54 |
if (e.getValue() == value) |
|
55 |
return e; |
|
56 |
} |
|
57 |
return EM_TRANSMIT_PROXY_MODE.EM_TRANSMIT_PROXY_MODE_LOCAL; |
|
58 |
} |
|
59 |
|
|
60 |
} |