提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
/** |
|
3 |
* @author : 291189 |
|
4 |
* @description : 进出方向 |
|
5 |
* @since : Created in 2022/05/26 |
|
6 |
*/ |
|
7 |
public enum EM_USER_PASS_TYPE { |
|
8 |
EM_USER_PASS_TYPE_UNKNOWN(0,"未知"), |
|
9 |
EM_USER_PASS_TYPE_ENTRY(1,"进门"), // 进门 |
|
10 |
EM_USER_PASS_TYPE_EXIT(2,"出门"); // 出门 |
|
11 |
|
|
12 |
private int value; |
|
13 |
|
|
14 |
private String note; |
|
15 |
|
|
16 |
public String getNote() { |
|
17 |
return note; |
|
18 |
} |
|
19 |
|
|
20 |
public int getValue() { |
|
21 |
return value; |
|
22 |
} |
|
23 |
|
|
24 |
EM_USER_PASS_TYPE(int givenValue, String note) { |
|
25 |
this.value = givenValue; |
|
26 |
this.note = note; |
|
27 |
} |
|
28 |
|
|
29 |
public static String getNoteByValue(int givenValue) { |
|
30 |
for (EM_USER_PASS_TYPE enumType : EM_USER_PASS_TYPE.values()) { |
|
31 |
if (givenValue == enumType.getValue()) { |
|
32 |
return enumType.getNote(); |
|
33 |
} |
|
34 |
} |
|
35 |
return null; |
|
36 |
} |
|
37 |
|
|
38 |
public static int getValueByNote(String givenNote) { |
|
39 |
for (EM_USER_PASS_TYPE enumType : EM_USER_PASS_TYPE.values()) { |
|
40 |
if (givenNote.equals(enumType.getNote())) { |
|
41 |
return enumType.getValue(); |
|
42 |
} |
|
43 |
} |
|
44 |
return -1; |
|
45 |
} |
|
46 |
|
|
47 |
public static EM_USER_PASS_TYPE getEnum(int value) { |
|
48 |
for (EM_USER_PASS_TYPE e : EM_USER_PASS_TYPE.values()) { |
|
49 |
if (e.getValue() == value) |
|
50 |
return e; |
|
51 |
} |
|
52 |
return EM_USER_PASS_TYPE.EM_USER_PASS_TYPE_UNKNOWN; |
|
53 |
} |
|
54 |
} |