On Fri, May 27, 2011 at 9:42 AM, Maxrunner <joao.rossa_at_gmail.com> 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 +-