use of javax.xml.bind.JAXBContext in project ORCID-Source by ORCID.
the class BlackBoxBaseRC3 method unmarshall.
public Object unmarshall(Reader reader, Class<?> type) {
try {
JAXBContext context = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
return unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.JAXBContext in project ORCID-Source by ORCID.
the class OrcidRecordToSolrDocumentTest method getRecord.
private Record getRecord(String name) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Record.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
InputStream inputStream = this.getClass().getResourceAsStream(name);
return (Record) unmarshaller.unmarshal(inputStream);
}
use of javax.xml.bind.JAXBContext in project ORCID-Source by ORCID.
the class OrcidClientGroup method toString.
@Override
public String toString() {
try {
JAXBContext context = JAXBContext.newInstance(getClass());
StringWriter writer = new StringWriter();
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(this, writer);
return writer.toString();
} catch (JAXBException e) {
return ("Unable to unmarshal because: " + e);
}
}
use of javax.xml.bind.JAXBContext in project ORCID-Source by ORCID.
the class OrcidClientGroup method unmarshall.
public static OrcidClientGroup unmarshall(InputStream input) {
try {
JAXBContext context = JAXBContext.newInstance(OrcidClientGroup.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (OrcidClientGroup) unmarshaller.unmarshal(input);
} catch (JAXBException e) {
// XXX Should be more specific exception
throw new RuntimeException("Unable to unmarshall client group" + e);
}
}
use of javax.xml.bind.JAXBContext in project ORCID-Source by ORCID.
the class OrcidMessage method unmarshall.
public static OrcidMessage unmarshall(Reader reader) {
try {
JAXBContext context = JAXBContext.newInstance(OrcidMessage.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (OrcidMessage) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
// XXX Should be more specific exception
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
Aggregations