}
protected abstract <T> Class<T> mapToJavaClass(ElementInfo elementInfo) throws OpsException;
public <T> T promoteToTyped(UntypedItem untypedItem, Class<T> itemClass) throws OpsException {
JaxbHelper jaxbHelper = JaxbHelper.get(itemClass);
T typedItem;
try {
Element element = ((UntypedItemXml) untypedItem).getDataElement();
String xmlElementName = jaxbHelper.getXmlElementName();
String nodeName = element.getLocalName();
if (!Objects.equal(xmlElementName, nodeName)) {
String type = element.getAttribute("xsi:type");
if (type != null && type.endsWith(":" + xmlElementName)) {
// OK
} else {
throw new OpsException("Incorrect element type: " + xmlElementName + " vs " + nodeName);
}
}
T object = jaxbHelper.unmarshal(element, itemClass);
if (!(object.getClass().isAssignableFrom(itemClass))) {
System.out.println("XML = " + ((UntypedItemXml) untypedItem).serialize());
}