TopicsEnum.java
833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cn.com.glsx.kafka.common.enums;
import lombok.Getter;
/**
* 设备上点相关topic枚举类
*/
@Getter
public enum TopicsEnum {
/**
* gps轨迹
*/
GPS_GPSDATA(1, "gps_gpsdata"),
/**
* gps基站
*/
GPS_BASESTATION(2, "gps_basestation"),
/**
* GPS和基站
*/
GPS_GPSANDBS(3, "gps_gpsandbs"),
/**
* 设备状态
*/
DEVICE_STATE(4, "device_state");
private Integer id;
private String topic;
TopicsEnum(Integer id, String topic) {
this.id = id;
this.topic = topic;
}
public static TopicsEnum getTopic(String topic) {
for (TopicsEnum entity : TopicsEnum.values()) {
if (entity.getTopic().equals(topic)) {
return entity;
}
}
return null;
}
}