Xiajijian
2025-11-26 d85eddf40bc7d5db0c8f4ec6cd74ade775ff2c57
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
package com.ard.work.domain.enums;
 
public enum MessageType {
    HEARTBEAT("heartbeat"),
    STREAM("stream"),
    STATE("state"),
    TELEMETRY("telemetry"),
    SIGNAL("signal"),
    CONTROLLER("controller"),
    ALL("all");
 
    private final String type;
 
    MessageType(String type) {
        this.type = type;
    }
 
    public String getType() {
        return type;
    }
 
    public static MessageType fromString(String type) {
        for (MessageType messageType : MessageType.values()) {
            if (messageType.type.equalsIgnoreCase(type)) {
                return messageType;
            }
        }
        throw new IllegalArgumentException("Unknown message type: " + type);
    }
}