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