Creates a new instance of {@link Marshaller}. The {@link Marshaller} can be usedto convert JAXB objects into XML data.
Note: Marshallers are reusable, but not reentrant (thread safe).
155156157158159160161162163164165
} private String toString(Object object, Class<?> type) throws JAXBException { JAXBContext jaxbContext = JAXBContextFactory.newInstance(type); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(object, baos);
5354555657585960616263
return new String(baos.toByteArray()); } public static <T> void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException { JAXBContext ctx2 = getContext(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); marshaller.marshal(object, out); }
3738394041424344454647
*/ public class JpaJaxbUtil { public static <T>String marshal(Class<T> type, Object object) throws JAXBException { JAXBContext ctx2 = JAXBContextFactory.newInstance(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(object, baos);
4950515253545556575859
return new String(baos.toByteArray()); } public static <T> void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException { JAXBContext ctx2 = JAXBContextFactory.newInstance(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); marshaller.marshal(object, out);
5152535455565758596061
return jaxbContext; } public static <T>String marshal(Class<T> type, Object object) throws JAXBException { JAXBContext ctx2 = getContext(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(object, baos);
5253545556575859606162
unmarshaller.setEventHandler(new TestValidationEventHandler()); Object object = unmarshaller.unmarshal(new ByteArrayInputStream(expected.getBytes())); assertTrue(object instanceof OpenejbJar); Marshaller marshaller = ctx.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(object, baos);
5859606162636465666768
return new String(baos.toByteArray()); } public static <T>void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException { JAXBContext ctx2 = JaxbJavaee.getContext(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); marshaller.marshal(object, out); }
5960616263646566676869
return new String(baos.toByteArray()); } public static <T>void marshal(Class<T> type, Object object, OutputStream out) throws JAXBException { JAXBContext ctx2 = JaxbWls.getContext(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); marshaller.marshal(object, out); }
8283848586878889909192
Persistence element = (Persistence) unmarshaller.unmarshal(new ByteArrayInputStream(expected.getBytes())); unmarshaller.setEventHandler(new TestValidationEventHandler()); System.out.println("unmarshalled"); Marshaller marshaller = ctx.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(element, baos);
4243444546474849505152
*/ public class JaxbSun { public static <T>String marshal(Class<T> type, Object object) throws JAXBException { JAXBContext ctx2 = JAXBContextFactory.newInstance(type); Marshaller marshaller = ctx2.createMarshaller(); marshaller.setProperty("jaxb.formatted.output", true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(object, baos);