use of com.fasterxml.jackson.dataformat.xml.XmlMapper in project tutorials by eugenp.
the class SimpleBeanForCapitalizedFields method whenJavaGotFromXmlStrWithCapitalElem_thenCorrect.
@Test
public void whenJavaGotFromXmlStrWithCapitalElem_thenCorrect() throws IOException {
XmlMapper xmlMapper = new XmlMapper();
SimpleBeanForCapitalizedFields value = xmlMapper.readValue("<SimpleBeanForCapitalizedFields><X>1</X><y>2</y></SimpleBeanForCapitalizedFields>", SimpleBeanForCapitalizedFields.class);
assertTrue(value.getX() == 1 && value.getY() == 2);
}
use of com.fasterxml.jackson.dataformat.xml.XmlMapper in project tutorials by eugenp.
the class SimpleBeanForCapitalizedFields method whenJavaGotFromXmlStr_thenCorrect.
@Test
public void whenJavaGotFromXmlStr_thenCorrect() throws IOException {
XmlMapper xmlMapper = new XmlMapper();
SimpleBean value = xmlMapper.readValue("<SimpleBean><x>1</x><y>2</y></SimpleBean>", SimpleBean.class);
assertTrue(value.getX() == 1 && value.getY() == 2);
}
use of com.fasterxml.jackson.dataformat.xml.XmlMapper in project ihmc-pub-sub by ihmcrobotics.
the class XMLSerializer method createXMLObjectMapper.
private static ObjectMapper createXMLObjectMapper() {
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
XmlMapper objectMapper = new XmlMapper(module);
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
return objectMapper;
}
Aggregations