dongyukun
2024-11-05 e8ad669f7c97d45cd23630dc101180a130d6c17e
提交 | 用户 | 时间
ce910c 1 package com.netsdk.lib.enumeration;
H 2
3 public enum EM_CITIZENIDCARD_SEX_TYPE {
4     /**
5      * 未知
6      */
7     EM_CITIZENIDCARD_SEX_TYPE_UNKNOWN(0, "未知"),
8     /**
9      * 男
10      */
11     EM_CITIZENIDCARD_SEX_TYPE_MALE(1, "男"),
12     /**
13      * 女
14      */
15     EM_CITIZENIDCARD_SEX_TYPE_FEMALE(2, "女"),
16     /**
17      * 未说明
18      */
19     EM_CITIZENIDCARD_SEX_TYPE_UNTOLD(3, "未说明");
20
21     private int value;
22     private String note;
23
24     private EM_CITIZENIDCARD_SEX_TYPE(int givenValue, String note) {
25         this.value = givenValue;
26         this.note = note;
27     }
28
29     public String getNote() {
30         return note;
31     }
32
33     public int getValue() {
34         return value;
35     }
36
37     public static String getNoteByValue(int givenValue) {
38         for (EM_CITIZENIDCARD_SEX_TYPE enumType : EM_CITIZENIDCARD_SEX_TYPE.values()) {
39             if (givenValue == enumType.getValue()) {
40                 return enumType.getNote();
41             }
42         }
43         return null;
44     }
45
46     public static int getValueByNote(String givenNote) {
47         for (EM_CITIZENIDCARD_SEX_TYPE enumType : EM_CITIZENIDCARD_SEX_TYPE.values()) {
48             if (givenNote.equals(enumType.getNote())) {
49                 return enumType.getValue();
50             }
51         }
52         return -1;
53     }
54 }