@Test public void shouldSerializeGenericClass() { String expectedResult = "<genericWrapper>\n <entityList class=\"list\">\n <client>\n <name>washington botelho</name>\n </client>\n <client>\n <name>washington botelho</name>\n </client>\n </entityList>\n <total>2</total>\n</genericWrapper>"; Collection<Client> entityList = new ArrayList<Client>(); entityList.add(new Client("washington botelho")); entityList.add(new Client("washington botelho")); GenericWrapper<Client> wrapper = new GenericWrapper<Client>(entityList, entityList.size()); serialization.from(wrapper).include("entityList").serialize(); assertThat(result(), is(equalTo(expectedResult))); }
public <T> Serializer from(T object) { response.setContentType("application/xml"); return getSerializer().from(object); }
XStreamXMLSerialization implements XMLSerialization { public <T> Serializer from(T object) { response.setContentType("application/xml"); return getSerializer().from(object); } }
XStreamXMLSerialization implements XMLSerialization { public <T> Serializer from(T object) { response.setContentType("application/xml"); return getSerializer().from(object); } XStreamXMLSerialization(HttpServletResponse response, TypeNameExtractor extractor, ProxyInitializer initializer, XStreamBuilder builder); }
XStreamXMLSerialization implements XMLSerialization { public <T> Serializer from(T object) { response.setContentType("application/xml"); return getSerializer().from(object); } XStreamXMLSerialization(HttpServletResponse response, TypeNameExtractor extractor, ProxyInitializer initializer, XStreamBuilder builder); boolean accepts(String format); Serializer from(T object); Serializer from(T object, String alias); }
XStreamXMLSerialization implements XMLSerialization { public <T> Serializer from(T object) { response.setContentType("application/xml"); return getSerializer().from(object); } XStreamXMLSerialization(HttpServletResponse response, TypeNameExtractor extractor, ProxyInitializer initializer, XStreamBuilder builder); boolean accepts(String format); Serializer from(T object); Serializer from(T object, String alias);  }