I think you need to create another object to do this. Something like:
@XmlRootElement
class MyItemContainer {
@XmlElement
private final List<MyItem> items;
public MyItemContainer( final List<MyItem> contained ) {
this.items = new ArrayList<MyItem>( contained );
}
@XmlAttribute( name = "total" )
public int getSize() {
return items.size();
}
}
Chris
On Tue, Apr 21, 2009 at 2:37 PM, Patel, Sanjay <sapatel_at_nemours.org> wrote:
> Hey,
>
> I am using jersey/jaxb to convert my list of objects to JSON. I want to add
> extra property to my generated JSON (e.g "total": total_objects_in_list).
> How can I do that??
>
> Sanjay