LanguageLevel (String level, LanguageLevel defaultLevel) { for (LanguageLevel languageLevel : LanguageLevel.values()) { if (level.equals(languageLevel.name())) { return languageLevel; } } return defaultLevel; }