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!");
|
}
|
}
|