package com.ard.sample.component.websocket.enums; public enum MessageType { STATE("state"), STATUS("status"), CONTROL("control"), PROGRESS("progress"), 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); } }