| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package com.goafanti.common.enums;
- import java.util.HashMap;
- import java.util.Map;
- import org.apache.commons.lang3.StringUtils;
- public enum DemandSwitchSign {
- OPEN(0, "不删除成果所有人ID"),
- CLOSE(1,"删除成果所有人ID"),
- OTHER(2, "其他");
- private DemandSwitchSign(Integer code, String desc) {
- this.code = code;
- this.desc = desc;
- }
- private static Map<Integer, DemandSwitchSign> status = new HashMap<Integer, DemandSwitchSign>();
- static {
- for (DemandSwitchSign value : DemandSwitchSign.values()) {
- status.put(value.getCode(), value);
- }
- }
- public static DemandSwitchSign getStatus(Integer code) {
- if (containsType(code)) {
- return status.get(code);
- }
- return OTHER;
- }
- public static DemandSwitchSign getStatus(String code) {
- if (StringUtils.isNumeric(code)) {
- return getStatus(Integer.parseInt(code));
- }
- return OTHER;
- }
- public static boolean containsType(Integer code) {
- return status.containsKey(code);
- }
- private Integer code;
- private String desc;
- public Integer getCode() {
- return code;
- }
- public String getDesc() {
- return desc;
- }
- }
|