[测评系统]--测评系统核心代码库
linzhijie
2021-03-11 84fea994d2db7dc313ad1774f34eb12a45f8d6e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.ots.common.enums;
import lombok.Getter;
import java.util.Objects;
 
@Getter
public enum LangTypeEnum {
    Chinese("Chinese", "中文"), English("English", "English"), Thai("Thai", "ไทย");
    private final String code;
    private final String message;
    LangTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public static LangTypeEnum codeOf(String code) {
        for (LangTypeEnum xxxEnum : values()) {
            if (Objects.equals(xxxEnum.getCode(), code)) {
                return xxxEnum;
            }
        }
        throw new RuntimeException("The language is not supported!");
    }
}