提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
public enum NET_EM_LXSJ_TRANSMODE { |
|
4 |
/**未知*/ |
|
5 |
NET_EM_LXSJ_TRANSMODE_UNKNOWN(-1,"未知"), |
|
6 |
/**TCP方式*/ |
|
7 |
NET_EM_LXSJ_TRANSMODE_TCP(0,"TCP方式"), |
|
8 |
/**UDP方式*/ |
|
9 |
NET_EM_LXSJ_TRANSMODE_UD(1,"UDP方式"); |
|
10 |
|
|
11 |
private int value; |
|
12 |
|
|
13 |
private String note; |
|
14 |
|
|
15 |
public String getNote() { |
|
16 |
return note; |
|
17 |
} |
|
18 |
|
|
19 |
public int getValue() { |
|
20 |
return value; |
|
21 |
} |
|
22 |
|
|
23 |
NET_EM_LXSJ_TRANSMODE(int givenValue, String note) { |
|
24 |
this.value = givenValue; |
|
25 |
this.note = note; |
|
26 |
} |
|
27 |
|
|
28 |
public static String getNoteByValue(int givenValue) { |
|
29 |
for (NET_EM_LXSJ_TRANSMODE enumType : NET_EM_LXSJ_TRANSMODE.values()) { |
|
30 |
if (givenValue == enumType.getValue()) { |
|
31 |
return enumType.getNote(); |
|
32 |
} |
|
33 |
} |
|
34 |
return null; |
|
35 |
} |
|
36 |
|
|
37 |
public static int getValueByNote(String givenNote) { |
|
38 |
for (NET_EM_LXSJ_TRANSMODE enumType : NET_EM_LXSJ_TRANSMODE.values()) { |
|
39 |
if (givenNote.equals(enumType.getNote())) { |
|
40 |
return enumType.getValue(); |
|
41 |
} |
|
42 |
} |
|
43 |
return -1; |
|
44 |
} |
|
45 |
|
|
46 |
public static NET_EM_LXSJ_TRANSMODE getEnum(int value) { |
|
47 |
for (NET_EM_LXSJ_TRANSMODE e : NET_EM_LXSJ_TRANSMODE.values()) { |
|
48 |
if (e.getValue() == value) |
|
49 |
return e; |
|
50 |
} |
|
51 |
return NET_EM_LXSJ_TRANSMODE.NET_EM_LXSJ_TRANSMODE_UNKNOWN; |
|
52 |
} |
|
53 |
|
|
54 |
} |