java枚举类的定义与使用
1.定义枚举类
public enum RedActiveStatusEnum {
NO_START("未开始", 1),
READY("准备中", 2),
PROCESSING("进行中", 3),
END_NO_FINISH("已结束领取未完成", 4),
END_YES_FINISH("已结束领取完成", 5),
END_FORCE("强制结束",6);
private String name;
private Integer value;
private RedActiveStatusEnum(String name, Integer value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
2.使用枚举类
RedActiveStatusEnum.NO_START.getValue()