Configuration (@NotNull Element element) { final String name = element.getName(); final Configuration config; if (name.equals(SEARCH_TAG_NAME)) { config = new SearchConfiguration(); } else if (name.equals(REPLACE_TAG_NAME)) { config = new ReplaceConfiguration(); } else { return null; } config.readExternal(element); return config; }