public enum PermissionEnum { ECMNG_ACCESS_MANAGE("ECMNG_ACCESS_MANAGE", "内部权限管理"), // ECMNG_CLASSIFY("ECMNG_CLASSIFY", "分类管理"), // ECMNG_NEW("ECMNG_NEW", "新建区域"), // ECMNG_CONTENT_MODIFY("ECMNG_CONTENT_MODIFY", "内容修改"), // ECMNG_TEMPLATE_MODIFY("ECMNG_TEMPLATE_MODIFY", "模板修改"), // ECMNG_TEST("ECMNG_TEST", "测试"), // ECMNG_PUBLISH("ECMNG_PUBLISH", "发布"); /** 枚举值 */ private String code; /** 描述 */ private String message; /** * @param code * @param message */ PermissionEnum(String code, String message) { this.code = code; this.message = message; } /** * 根据code获取枚举类实例 * @param code * @return */ public static PermissionEnum getByCode(String code) { for (PermissionEnum order : values()) { if (StringUtils.equals(order.code, code)) return order; } return null; } /** * Getter method for property <tt>code</tt>. * * @return property value of code */ public String getCode() { return code; } /** * Setter method for property <tt>code</tt>. * * @param code value to be assigned to property code */ public void setCode(String code) { this.code = code; } /** * Getter method for property <tt>message</tt>. * * @return property value of message */ public String getMessage() { return message; } /** * Setter method for property <tt>message</tt>. * * @param message value to be assigned to property message */ public void setMessage(String message) { this.message = message; } }
枚举的使用方法
猜你喜欢
转载自yonge812.iteye.com/blog/1310005
今日推荐
周排行