You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicenumMyType {
V1("val1"),
V2("val2"),
V3("val3"),
V4("val4"),
V5("val5"),
V6("val6");
privatefinalStringname;
MyType(Stringname) {
this.name = name;
}
publicstaticMyTypefromString(Stringname) {
for (MyTypetype : MyType.values()) {
if (type.name.equals(name)) {
returntype;
}
}
// In case no matching delegate to default parser which will throw a// IllegalArgumentException if it's unable to parse the namereturnMyType.valueOf(name.toUpperCase());
}
@OverridepublicStringtoString() {
returnname;
}
}