提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* 录象类型(定时、动态检测、报警) |
|
5 |
* |
|
6 |
* @author 47040 |
|
7 |
* @since Created at 2021/5/25 23:00 |
|
8 |
*/ |
|
9 |
public enum REC_TYPE { |
|
10 |
NET_REC_TYPE_TIM(0, "定时"), |
|
11 |
NET_REC_TYPE_MTD(1, "动态"), |
|
12 |
NET_REC_TYPE_ALM(2, "报警"), |
|
13 |
NET_REC_TYPE_NUM(3, "数量"); |
|
14 |
|
|
15 |
private final int value; |
|
16 |
private final String note; |
|
17 |
|
|
18 |
REC_TYPE(int givenValue, String note) { |
|
19 |
this.value = givenValue; |
|
20 |
this.note = note; |
|
21 |
} |
|
22 |
|
|
23 |
public String getNote() { |
|
24 |
return note; |
|
25 |
} |
|
26 |
|
|
27 |
public int getValue() { |
|
28 |
return value; |
|
29 |
} |
|
30 |
|
|
31 |
public static String getNoteByValue(int givenValue) { |
|
32 |
for (REC_TYPE enumType : REC_TYPE.values()) { |
|
33 |
if (givenValue == enumType.getValue()) { |
|
34 |
return enumType.getNote(); |
|
35 |
} |
|
36 |
} |
|
37 |
return null; |
|
38 |
} |
|
39 |
|
|
40 |
public static int getValueByNote(String givenNote) { |
|
41 |
for (REC_TYPE enumType : REC_TYPE.values()) { |
|
42 |
if (givenNote.equals(enumType.getNote())) { |
|
43 |
return enumType.getValue(); |
|
44 |
} |
|
45 |
} |
|
46 |
return -1; |
|
47 |
} |
|
48 |
|
|
49 |
public static REC_TYPE getEnum(int value) { |
|
50 |
for (REC_TYPE e : REC_TYPE.values()) { |
|
51 |
if (e.getValue() == value) |
|
52 |
return e; |
|
53 |
} |
|
54 |
return REC_TYPE.NET_REC_TYPE_TIM; |
|
55 |
} |
|
56 |
} |