package com.ard.tianyu.domain.enums; public enum MessageType { 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); } }