List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller setClassesToBeBound
public void setClassesToBeBound(@Nullable Class<?>... classesToBeBound)
From source file:org.springframework.batch.item.xml.Jaxb2NamespaceMarshallingTests.java
protected Marshaller getMarshaller() throws Exception { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(new Class<?>[] { QualifiedTrade.class }); marshaller.afterPropertiesSet();/*from ww w . java 2s . c om*/ StringWriter string = new StringWriter(); marshaller.marshal(new QualifiedTrade("FOO", 100, BigDecimal.valueOf(10.), "bar"), new StreamResult(string)); String content = string.toString(); assertTrue("Wrong content: " + content, content.contains("<customer>bar</customer>")); return marshaller; }