提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 260611 |
|
6 |
* @description 订阅类型 |
|
7 |
* @date 2022/04/20 10:16:56 |
|
8 |
*/ |
|
9 |
public enum EM_ATTACH_TOPICS { |
|
10 |
/** |
|
11 |
* 表示订阅所有属性和事件 |
|
12 |
*/ |
|
13 |
EM_ATTACH_TOPICS_ALL(0, " * 表示订阅所有属性和事件"), |
|
14 |
/** |
|
15 |
* Props 表示订阅设备属性上报 |
|
16 |
*/ |
|
17 |
EM_ATTACH_TOPICS_PROPS(1, " Props 表示订阅设备属性上报"), |
|
18 |
/** |
|
19 |
* Events 标识订阅设备事件上报 |
|
20 |
*/ |
|
21 |
EM_ATTACH_TOPICS_EVENTS(2, " Events 标识订阅设备事件上报"); |
|
22 |
|
|
23 |
private int value; |
|
24 |
|
|
25 |
private String note; |
|
26 |
|
|
27 |
public String getNote() { |
|
28 |
return note; |
|
29 |
} |
|
30 |
|
|
31 |
public int getValue() { |
|
32 |
return value; |
|
33 |
} |
|
34 |
|
|
35 |
EM_ATTACH_TOPICS(int givenValue, String note) { |
|
36 |
this.value = givenValue; |
|
37 |
this.note = note; |
|
38 |
} |
|
39 |
|
|
40 |
public static String getNoteByValue(int givenValue) { |
|
41 |
for (EM_ATTACH_TOPICS enumType : EM_ATTACH_TOPICS.values()) { |
|
42 |
if (givenValue == enumType.getValue()) { |
|
43 |
return enumType.getNote(); |
|
44 |
} |
|
45 |
} |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
public static int getValueByNote(String givenNote) { |
|
50 |
for (EM_ATTACH_TOPICS enumType : EM_ATTACH_TOPICS.values()) { |
|
51 |
if (givenNote.equals(enumType.getNote())) { |
|
52 |
return enumType.getValue(); |
|
53 |
} |
|
54 |
} |
|
55 |
return -1; |
|
56 |
} |
|
57 |
|
|
58 |
public static EM_ATTACH_TOPICS getEnum(int value) { |
|
59 |
for (EM_ATTACH_TOPICS e : EM_ATTACH_TOPICS.values()) { |
|
60 |
if (e.getValue() == value) |
|
61 |
return e; |
|
62 |
} |
|
63 |
return EM_ATTACH_TOPICS.EM_ATTACH_TOPICS_ALL; |
|
64 |
} |
|
65 |
|
|
66 |
} |