Skip to content

Instantly share code, notes, and snippets.

@adixchen
Created October 9, 2019 12:58
Show Gist options
  • Save adixchen/1f3d590311d837f40528093b28eae97f to your computer and use it in GitHub Desktop.
Save adixchen/1f3d590311d837f40528093b28eae97f to your computer and use it in GitHub Desktop.
language type enum
@XmlType(name = "LanguageType")
@XmlEnum
public enum LanguageType {
@XmlEnumValue("de")
DE("de"),
@XmlEnumValue("fr")
FR("fr"),
@XmlEnumValue("it")
IT("it"),
@XmlEnumValue("en")
EN("en");
private final String value;
LanguageType(String v) {
value = v;
}
public String value() {
return value;
}
public static LanguageType fromValue(String v) {
for (LanguageType c: LanguageType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment