I have a Links object that has a List member, while a link has only attributes, but the analysis of the list has something wrong - it is created empty.
In the test below links.getLinks() returns an empty list. Any ideas?
XML example:
<links> <link x="1" y="2" /> <link x="3" y="4" /> </links>
Java
@JacksonXmlRootElement(localName="links") public class Links extends BaseAmebaElement { @JacksonXmlProperty(localName="link")
...
@JacksonXmlRootElement(localName="link") public class Link { @JacksonXmlProperty(localName="x", isAttribute=true) private String href; @JacksonXmlProperty(localName="y", isAttribute=true) private String rel;
...
XmlMapper xmlMapper = new XmlMapper (); try { Links links = xmlMapper.readValue(input, Links.class); assertNotNull(links); assertNotNull(links.getLinks()); assertEquals(2, links.getLinks().size()); } catch (Throwable e) { fail(e.getMessage()); }
source share