private Object loadGeneric(TypeClassInfo info, Element mapping, String componentType) {
if (componentType.startsWith("#")) {
String name = componentType.substring(1);
Element propertyEl = getMatch(mapping, "./component[@name='" + name + "']");
if (propertyEl == null) {
throw new DatabindingException("Could not find <component> element in mapping named '" + name
+ "'");
}
TypeClassInfo componentInfo = new TypeClassInfo();
componentInfo.setDescription("generic component " + componentInfo.getDescription());
readMetadata(componentInfo, mapping, propertyEl);
String className = propertyEl.getAttributeValue("class");
if (className == null) {
throw new DatabindingException("A 'class' attribute must be specified for <component> "
+ name);
}
componentInfo.setTypeClass(loadComponentClass(className));