private static Language getLanguageOrExit(final String lang) { Language language = null; boolean foundLanguage = false; final List<String> supportedLanguages = new ArrayList<>(); for (final Language tmpLang : Languages.get()) { supportedLanguages.add(tmpLang.getShortName()); if (lang.equals(tmpLang.getShortName())) { language = tmpLang; foundLanguage = true; break; } } if (!foundLanguage) { System.out.println( "Unknown language '" + lang + "'. Supported languages are: " + supportedLanguages); exitWithUsageMessage(); } return language; }
public static void main(String[] args) throws IOException { RuleSimplifier prg = new RuleSimplifier(); prg.run(Languages.getLanguageForShortName("de")); }