package com.vci.web.enumpck; import com.vci.common.portal.enums.GetByType; import com.vci.constant.PortalVIEnumConstant; import com.vci.starter.web.annotation.VciEnum; /** * 表单类型 * @author xiej * */ @VciEnum(name = PortalVIEnumConstant.PORTALVI_VI_TYPE,text = "表单类型") public enum PortalVIType { Form("Form", "表单", (short)1), Table("Table", "表格", (short)0); private String name = ""; private String label = ""; private short intVal = 1; private PortalVIType(String name, String label, short intVal){ this.name = name; this.label = label; this.intVal = intVal; } public static PortalVIType getByName(String name){ PortalVIType res = getByType(GetByType.Name, name); return res; } public static PortalVIType getByLabel(String label){ PortalVIType res = getByType(GetByType.Label, label); return res; } public static PortalVIType getByIntVal(int intVal){ PortalVIType res = getByType(GetByType.IntVal, String.valueOf(intVal)); return res; } public static PortalVIType getByType(GetByType type, String val){ PortalVIType[] alls = getAll(); PortalVIType res = null; for(PortalVIType 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 PortalVIType[] getAll(){ return PortalVIType.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 short getIntVal() { return intVal; } public void setIntVal(short intVal) { this.intVal = intVal; } }