#
vincentlu
6 天以前 1e4747e668a0ef50f0c7bfd0ded0c48ff6c64b71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.zy.acs.manager.core.domain.type;
 
import com.zy.acs.framework.common.Cools;
 
public enum CommonType {
 
    TRUE(1, "Y"),
    FALSE(0, "N"),
    NONE(-1, "N/A"),
    ;
 
    public int num;
    public String str;
 
    CommonType(int num, String str) {
        this.num = num;
        this.str = str;
    }
 
    public static CommonType of(int num) {
        for (CommonType type : CommonType.values()) {
            if (type.num == num) {
                return type;
            }
        }
        return CommonType.NONE;
    }
 
    public static CommonType of(String str) {
        if (Cools.isEmpty(str)) {
            return CommonType.NONE;
        }
        for (CommonType type : CommonType.values()) {
            if (type.str.equals(str)) {
                return type;
            }
        }
        return CommonType.NONE;
    }
 
}