To generate a instance of a enum class by a given string you can use the valueOf() method.
public class EnumByGivenStringSample {
private enum Language
{
JAVA, RUBY, SCALA, GROOVY, CLOJURE
}
public static Language languageByString(String language)
{
return Language.valueOf(language);
}
}
Information about Data protection