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.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);
| }
|
| }
|
|