package com.vci.common.portal.enums; /** * 区域类型 * @author xiongchao * */ public enum AreaType { Navigator("Navigator", "导航区", 1), Control("Control", "控制区", 2), Operation("Operation", "操作区", 3); private String name = ""; private String label = ""; private int intVal = 1; private AreaType(String name, String label, int intVal){ this.name = name; this.label = label; this.intVal = intVal; } public static AreaType getByName(String name){ AreaType res = getByType(GetByType.Name, name); return res; } public static AreaType getByLabel(String label){ AreaType res = getByType(GetByType.Label, label); return res; } public static AreaType getByIntVal(int intVal){ AreaType res = getByType(GetByType.IntVal, String.valueOf(intVal)); return res; } public static AreaType getByType(GetByType type, String val){ AreaType[] alls = getAll(); AreaType res = null; for(AreaType obj : alls){ if(type == GetByType.Name && obj.getName().equalsIgnoreCase(val)){ res = obj; break; } else if(type == GetByType.Label && obj.getLabel().equalsIgnoreCase(val)){ res = obj; break; } else if(type == GetByType.IntVal && String.valueOf(obj.getIntVal()).equalsIgnoreCase(val)){ res = obj; break; } } return res; } public static AreaType[] getAll(){ return AreaType.values(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public int getIntVal() { return intVal; } public void setIntVal(int intVal) { this.intVal = intVal; } }