/* * Generated by Savara. */ package %PACKAGE%; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.dom.DOMSource; public class %CLASSNAME% extends org.switchyard.transform.BaseTransformer<DOMSource,%FAULTCLASS%> { public QName getFrom() { return (QName.valueOf("%FAULTQNAME%")); } public %FAULTCLASS% transform(DOMSource type) { Unmarshaller unmarshaller; JAXBContext _jaxbContext; try { _jaxbContext = JAXBContext.newInstance("%FAULTTYPEPACKAGE%"); } catch (JAXBException e) { throw new RuntimeException("Failed to create JAXBContext for '" + getFrom() + "'.", e); } try { unmarshaller = _jaxbContext.createUnmarshaller(); } catch (JAXBException e) { throw new RuntimeException("Failed to create Unmarshaller for type '" + getFrom() + "'.", e); } try { return new %FAULTCLASS%("%FAULTMESSAGE%", (%FAULTTYPE%)unmarshaller.unmarshal(type)); } catch (Exception e) { throw new RuntimeException("Failed to unmarshal fault", e); } } }