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