TopicsEnum.java 833 Bytes
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;
    }

}