package com.zy.acs.common.enums; import com.zy.acs.framework.exception.CoolException; public enum ActuatorDirectionType { LEFT(1), RIGHT(2), FORWARD(3), ; public int val; ActuatorDirectionType(int val) { this.val = val; } public static ActuatorDirectionType fromVal(Integer val) { if (null == val) { throw new CoolException("actuator direction param val is null"); } for (ActuatorDirectionType type : ActuatorDirectionType.values()) { if (type.val == val) { return type; } } throw new IllegalArgumentException("Invalid ActuatorDirectionType: " + val); } }