| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package com.xjrsoft.common.enums;
- /**
- * 课表时段
- */
- public enum TimePeriodEnum {
- /**
- * 上午
- */
- MORNING(1, "上午"),
- /**
- * 下午
- */
- AFTERNOON(2, "下午"),
- /**
- * 晚上
- */
- NIGHT(3, "晚上");
- final int code;
- final String value;
- public int getCode() {
- return this.code;
- }
- public String getValue() {
- return this.value;
- }
- TimePeriodEnum(final int code, final String message) {
- this.code = code;
- this.value = message;
- }
- public static int getCode(String value) {
- for (TimePeriodEnum c : TimePeriodEnum.values()) {
- if (c.getValue().equals(value)) {
- return c.getCode();
- }
- }
- return 0;
- }
- public static String getValue(int code) {
- for (TimePeriodEnum c : TimePeriodEnum.values()) {
- if (c.getCode() == code) {
- return c.getValue();
- }
- }
- return "";
- }
- }
|