zhaowenyu
2025-11-15 ae6cf3e11a1d05b38dc8c18af1d211839b2ff7b6
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);
    }
}