语言枚举

/**
* 会议信息语言枚举类型
*/
public enum LanguageEnum
{
/**
* 中文会议信息
*/
CHINESE("中文会议", "chinese"),
/**
* 英文会议信息
*/
ENGLISH("English Meeting", "english");

private String name;
private String code;

LanguageEnum(String name, String code)
{
this.name = name;
this.code = code;
}

public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}

public String getCode()
{
return code;
}

public void setCode(String code)
{
this.code = code;
}

public static boolean checkLanguage(String language)
{
LanguageEnum[] languageEnums = LanguageEnum.values();
for (LanguageEnum languageEnum : languageEnums)
{
if (languageEnum.code.equals(language))
{
return true;
}
}
return false;
}

public static LanguageEnum getLanguageEnumByCode(String language)
{
LanguageEnum[] languageEnums = LanguageEnum.values();
for (LanguageEnum languageEnum : languageEnums)
{
if (languageEnum.code.equals(language))
{
return languageEnum;
}
}
return null;
}
}
posted @ 2019-07-07 09:13  zzl0916  阅读(247)  评论(0编辑  收藏  举报