提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 行程码状态 |
|
6 |
* @date 2021/08/15 |
|
7 |
*/ |
|
8 |
public enum EM_TRAVEL_CODE_COLOR { |
|
9 |
// 未知 |
|
10 |
EM_TRAVEL_CODE_COLOR_UNKNOWN(0, "未知"), |
|
11 |
|
|
12 |
// 红 |
|
13 |
EM_TRAVEL_CODE_COLOR_RED(1, "红"), |
|
14 |
|
|
15 |
// 绿 |
|
16 |
EM_TRAVEL_CODE_COLOR_GREEN(2, "绿"), |
|
17 |
|
|
18 |
// 黄 |
|
19 |
EM_TRAVEL_CODE_COLOR_YELLOW(3, "黄"), |
|
20 |
// 橙 |
|
21 |
EM_TRAVEL_CODE_COLOR_ORANGE(4, "橙"); |
|
22 |
|
|
23 |
private int value; |
|
24 |
private String note; |
|
25 |
|
|
26 |
private EM_TRAVEL_CODE_COLOR(int givenValue, String note) { |
|
27 |
this.value = givenValue; |
|
28 |
this.note = note; |
|
29 |
} |
|
30 |
|
|
31 |
public String getNote() { |
|
32 |
return note; |
|
33 |
} |
|
34 |
|
|
35 |
public int getValue() { |
|
36 |
return value; |
|
37 |
} |
|
38 |
|
|
39 |
public static String getNoteByValue(int givenValue) { |
|
40 |
for (EM_TRAVEL_CODE_COLOR enumType : EM_TRAVEL_CODE_COLOR.values()) { |
|
41 |
if (givenValue == enumType.getValue()) { |
|
42 |
return enumType.getNote(); |
|
43 |
} |
|
44 |
} |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
public static int getValueByNote(String givenNote) { |
|
49 |
for (EM_TRAVEL_CODE_COLOR enumType : EM_TRAVEL_CODE_COLOR.values()) { |
|
50 |
if (givenNote.equals(enumType.getNote())) { |
|
51 |
return enumType.getValue(); |
|
52 |
} |
|
53 |
} |
|
54 |
return -1; |
|
55 |
} |
|
56 |
|
|
57 |
} |