}
}
typeMapping.setMatcher(matcher);
Converter converter = null;
if (element.hasAttribute("converter")) {
String converterClassName = element.getAttribute("converter");
ClassLoader classLoader = parser.getClassLoader();
try {
Class<?> converterClass = classLoader.loadClass(converterClassName);
converter = (Converter) converterClass.newInstance();
} catch (Exception e) {
parse.addProblem("couldn't instantiate converter "+converterClassName);
}
} else {
// look for the matcher element
Element converterElement = XmlUtil.element(element, "converter");
Element converterObjectElement = XmlUtil.element(converterElement);
if (converterObjectElement!=null) {
try {
converter = (Converter) parser.parseElement(converterObjectElement, parse);
} catch (ClassCastException e) {
parse.addProblem("converter is not a "+Converter.class.getName()+": "+(converter!=null ? converter.getClass().getName() : "null"));
}
}
}
typeMapping.setConverter(converter);