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
| public enum bl_type { USER_ID("user_id"), ACCOUNT_ID("account_id"), ADDRESS("address"); private String value;
bl_type(String value) { this.value = value; } public String getValue() { return this.value; } public static bl_type valueOfName(String name) { name=name.toLowerCase(); Map<String, bl_type> MAP = new HashMap<>(); for (bl_type season : values()) { MAP.put(season.value, season); } bl_type em=MAP.get(name); if(em==null) em=MAP.get(name.toUpperCase()); return MAP.get(name); }
}
|