提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 鉴权模式 |
|
6 |
* @date 2023/03/16 14:23:46 |
|
7 |
*/ |
|
8 |
public enum EM_CFG_AUTHMODE { |
|
9 |
/** |
|
10 |
* 不需要鉴权 |
|
11 |
*/ |
|
12 |
EM_AUTHMODE_NO(0, "不需要鉴权"), |
|
13 |
/** |
|
14 |
* PAP鉴权 |
|
15 |
*/ |
|
16 |
EM_AUTHMODE_PAP(1, "PAP鉴权"), |
|
17 |
/** |
|
18 |
* CHAP鉴权 |
|
19 |
*/ |
|
20 |
EM_AUTHMODE_CHAP(2, "CHAP鉴权"); |
|
21 |
|
|
22 |
private int value; |
|
23 |
|
|
24 |
private String note; |
|
25 |
|
|
26 |
public String getNote() { |
|
27 |
return note; |
|
28 |
} |
|
29 |
|
|
30 |
public int getValue() { |
|
31 |
return value; |
|
32 |
} |
|
33 |
|
|
34 |
EM_CFG_AUTHMODE(int givenValue, String note) { |
|
35 |
this.value = givenValue; |
|
36 |
this.note = note; |
|
37 |
} |
|
38 |
|
|
39 |
public static String getNoteByValue(int givenValue) { |
|
40 |
for (EM_CFG_AUTHMODE enumType : EM_CFG_AUTHMODE.values()) { |
|
41 |
if (givenValue == enumType.getValue()) { |
|
42 |
return enumType.getNote(); |
|
43 |
} |
|
44 |
} |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
public static int getValueByNote(String givenNote) { |
|
49 |
for (EM_CFG_AUTHMODE enumType : EM_CFG_AUTHMODE.values()) { |
|
50 |
if (givenNote.equals(enumType.getNote())) { |
|
51 |
return enumType.getValue(); |
|
52 |
} |
|
53 |
} |
|
54 |
return -1; |
|
55 |
} |
|
56 |
} |