提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 锁状态 |
|
7 |
* @date 2022/08/10 11:46:30 |
|
8 |
*/ |
|
9 |
public enum EM_VAULT_LOCKSTATE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_VAULT_LOCKSTATE_UNKNOWN(0,"未知"), |
|
14 |
/** |
|
15 |
关锁 |
|
16 |
*/ |
|
17 |
EM_VAULT_LOCKSTATE_ISCLOSED(1,"关锁"), |
|
18 |
/** |
|
19 |
开锁 |
|
20 |
*/ |
|
21 |
EM_VAULT_LOCKSTATE_ISOPENED(2,"开锁"); |
|
22 |
|
|
23 |
private int value; |
|
24 |
|
|
25 |
private String note; |
|
26 |
|
|
27 |
public String getNote() { |
|
28 |
return note; |
|
29 |
} |
|
30 |
|
|
31 |
public int getValue() { |
|
32 |
return value; |
|
33 |
} |
|
34 |
|
|
35 |
EM_VAULT_LOCKSTATE(int givenValue, String note) { |
|
36 |
this.value = givenValue; |
|
37 |
this.note = note; |
|
38 |
} |
|
39 |
|
|
40 |
public static String getNoteByValue(int givenValue) { |
|
41 |
for (EM_VAULT_LOCKSTATE enumType : EM_VAULT_LOCKSTATE.values()) { |
|
42 |
if (givenValue == enumType.getValue()) { |
|
43 |
return enumType.getNote(); |
|
44 |
} |
|
45 |
} |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
public static int getValueByNote(String givenNote) { |
|
50 |
for (EM_VAULT_LOCKSTATE enumType : EM_VAULT_LOCKSTATE.values()) { |
|
51 |
if (givenNote.equals(enumType.getNote())) { |
|
52 |
return enumType.getValue(); |
|
53 |
} |
|
54 |
} |
|
55 |
return -1; |
|
56 |
} |
|
57 |
|
|
58 |
public static EM_VAULT_LOCKSTATE getEnum(int value) { |
|
59 |
for (EM_VAULT_LOCKSTATE e : EM_VAULT_LOCKSTATE.values()) { |
|
60 |
if (e.getValue() == value) |
|
61 |
return e; |
|
62 |
} |
|
63 |
return EM_VAULT_LOCKSTATE.EM_VAULT_LOCKSTATE_UNKNOWN; |
|
64 |
} |
|
65 |
|
|
66 |
} |