package ams.util;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
public enum RightsType {
MENU_LIST("菜单栏", "菜单栏", false), MENU_ITEM("菜单项", "菜单项", false), BUTTON("按钮", "按钮", true);
private final String typeId;
private final String typeName;
private final boolean isLeaf;
private static final Map<String, RightsType> index = new HashMap<>();
static {
for (RightsType rightsType : EnumSet.allOf(RightsType.class)) {
index.put(rightsType.getTypeId(), rightsType);
}
}
public static RightsType getTypeByid(String typeId){
return index.get(typeId);
}
private RightsType(String typeId, String typeName, boolean isLeaf) {
this.typeId = typeId;
this.typeName = typeName;
this.isLeaf = isLeaf;
}
public String getTypeId() {
return typeId;
}
public String getTypeName() {
return typeName;
}
public boolean isLeaf() {
return isLeaf;
}
}
转载于:https://my.oschina.net/u/2313484/blog/632043