*Another possiblity is just a very simple wrapper bean. Something like:
public class ListWrapper<T> {
public List<T> rootNameIWant;
}
and return that instead of List. Or, if you want fully dynamic name *
*
*
Yes, but then you end up with two names, the listwrapper name and the type
of objects in the list:
{
ListWrapper:{
OrganicasMobileEntity:[{
......}]
}
}
*
*
just use Map<String, List<MyType>> by sub-classing:
On Fri, May 27, 2011 at 6:38 PM, Cowtowncoder [via Jersey] <
ml-node+6411899-481268136-73314_at_n2.nabble.com> wrote:
> On Fri, May 27, 2011 at 9:42 AM, Maxrunner <[hidden email]<http://user/SendEmail.jtp?type=node&node=6411899&i=0>>
> wrote:
> > So how can i use the xmlrootelement annotation on List type without
> > extending it?can you help me with this?ive lost too much time with this
> > already....
>
> Typically by using mix-in annotations,
> http://wiki.fasterxml.com/JacksonMixInAnnotations -- you associate
> annotations.
>
> Another possiblity is just a very simple wrapper bean. Something like:
>
> public class ListWrapper<T> {
> public List<T> rootNameIWant;
> }
>
> and return that instead of List. Or, if you want fully dynamic name
> just use Map<String, List<MyType>> by sub-classing:
>
> public class ListWrapperWithMap extends HashMap<String, List<ActualType>> {
>
> public ListWrapperWithMap(String rootName, List<ActualType> value) {
> this.put(rootName, value);
> }
> }
>
> and then:
>
> return new ListWrapperWithMap("rootName", listValue);
>
>
> -+ Tatu +-
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://jersey.576304.n2.nabble.com/how-to-rename-XmlRootElement-in-JSON-tp6173292p6411899.html
> To unsubscribe from how to rename XmlRootElement in JSON, click here<http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6173292&code=am9hby5yb3NzYUBnbWFpbC5jb218NjE3MzI5MnwyMDYzODA1MDkw>.
>
>
--
View this message in context: http://jersey.576304.n2.nabble.com/how-to-rename-XmlRootElement-in-JSON-tp6173292p6412655.html
Sent from the Jersey mailing list archive at Nabble.com.