Examples of JAXBOMDataSource


Examples of org.apache.axiom.om.ds.jaxb.JAXBOMDataSource

        OMFactory factory = OMAbstractFactory.getOMFactory();
        JAXBContext context = JAXBContext.newInstance(DocumentBean.class);
        DocumentBean orgBean = new DocumentBean();
        orgBean.setId("AB23498");
        orgBean.setContent(new DataHandler("test content", "text/plain"));
        OMElement element = factory.createOMElement(new JAXBOMDataSource(context, orgBean));
        DocumentBean bean = (DocumentBean)JAXBUtils.unmarshal(context, element, true);
        assertEquals(orgBean.getId(), bean.getId());
        assertEquals(orgBean.getContent(), bean.getContent());
    }
View Full Code Here

Examples of org.apache.axiom.om.ds.jaxb.JAXBOMDataSource

public class JAXBTest {
    @Test
    public void test() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        JAXBContext context = JAXBContext.newInstance(DummyBean.class);
        OMSourcedElement element = factory.createOMElement(new JAXBOMDataSource(context, new DummyBean()));
        element.serialize(new ByteArrayOutputStream());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.