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; } }