提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 动态密码锁错误码 |
|
7 |
* @date 2022/06/23 10:09:19 |
|
8 |
*/ |
|
9 |
public enum EM_DYNAMIC_LOCK_ERRORCODE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_DYNAMIC_LOCK_ERRORCODE_UNKNOWN(-1,"未知"), |
|
14 |
/** |
|
15 |
成功 |
|
16 |
*/ |
|
17 |
EM_DYNAMIC_LOCK_ERRORCODE_SUCCESS(0,"成功"), |
|
18 |
/** |
|
19 |
操作失败 |
|
20 |
*/ |
|
21 |
EM_DYNAMIC_LOCK_ERRORCODE_FAIL(1,"操作失败"), |
|
22 |
/** |
|
23 |
锁ID不存在 |
|
24 |
*/ |
|
25 |
EM_DYNAMIC_LOCK_ERRORCODE_LOCK_NO_EXIT(2,"锁ID不存在"), |
|
26 |
/** |
|
27 |
锁已初始化 |
|
28 |
*/ |
|
29 |
EM_DYNAMIC_LOCK_ERRORCODE_LOCK_INIT(3,"锁已初始化"), |
|
30 |
/** |
|
31 |
锁模块未启用 |
|
32 |
*/ |
|
33 |
EM_DYNAMIC_LOCK_ERRORCODE_LOCK_NOT_USE(4,"锁模块未启用"); |
|
34 |
|
|
35 |
private int value; |
|
36 |
|
|
37 |
private String note; |
|
38 |
|
|
39 |
public String getNote() { |
|
40 |
return note; |
|
41 |
} |
|
42 |
|
|
43 |
public int getValue() { |
|
44 |
return value; |
|
45 |
} |
|
46 |
|
|
47 |
EM_DYNAMIC_LOCK_ERRORCODE(int givenValue, String note) { |
|
48 |
this.value = givenValue; |
|
49 |
this.note = note; |
|
50 |
} |
|
51 |
|
|
52 |
public static String getNoteByValue(int givenValue) { |
|
53 |
for (EM_DYNAMIC_LOCK_ERRORCODE enumType : EM_DYNAMIC_LOCK_ERRORCODE.values()) { |
|
54 |
if (givenValue == enumType.getValue()) { |
|
55 |
return enumType.getNote(); |
|
56 |
} |
|
57 |
} |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
public static int getValueByNote(String givenNote) { |
|
62 |
for (EM_DYNAMIC_LOCK_ERRORCODE enumType : EM_DYNAMIC_LOCK_ERRORCODE.values()) { |
|
63 |
if (givenNote.equals(enumType.getNote())) { |
|
64 |
return enumType.getValue(); |
|
65 |
} |
|
66 |
} |
|
67 |
return -2; |
|
68 |
} |
|
69 |
|
|
70 |
public static EM_DYNAMIC_LOCK_ERRORCODE getEnum(int value) { |
|
71 |
for (EM_DYNAMIC_LOCK_ERRORCODE e : EM_DYNAMIC_LOCK_ERRORCODE.values()) { |
|
72 |
if (e.getValue() == value) |
|
73 |
return e; |
|
74 |
} |
|
75 |
return EM_DYNAMIC_LOCK_ERRORCODE.EM_DYNAMIC_LOCK_ERRORCODE_UNKNOWN; |
|
76 |
} |
|
77 |
|
|
78 |
} |