java - POJO with list of POJO to JSON display size and index -
so i've got 2 pojos:
public class requestdisplayinfo { private int nombrepersonne; private string courrielorganisateur; private requeststatus statutdemande; private string salleassigne; getters/setters.....
and
public class requestsdisplayinfo { private list<requestdisplayinfo> acceptees = new arraylist<requestdisplayinfo>(); private list<requestdisplayinfo> autres = new arraylist<requestdisplayinfo>(); getters/setters.....
when return second class, :
{ - acceptees: [1] 0: { organizeremail: "org" participants: 45 requeststatus: "accepted" roomname: "plt-2828" } - autres: [2] -0: { organizeremail: "org" participants: 2 requeststatus: "waiting" } -1: { organizeremail: "org" participants: 3 requeststatus: "waiting" } }
here how return
@get @path("/{email}") @produces(mediatype.application_json) @consumes({ "text/plain, text/html" }) public requestbyemaildisplay displaybyemail(@pathparam("email") string email) { list<request> requests = requestservice.displaybyemail(email); requestbyemaildisplay requestbyemaildisplay = new requestbyemaildisplay(); requests.foreach(request -> { if (request.isaccepted()) { requestbyemaildisplay.getacceptees().add(request.buildbyid()); } }); requests.foreach(request -> { if (!request.isaccepted()) { requestbyemaildisplay.getautres().add(request.buildbyid()); } }); return requestbyemaildisplay; }
which want... except fact displays size of list , index of each element.
edit i'm using jersey/jackson , directly returning in resources @produces(mediatype.application_json)
does know why , how remove it?
Comments
Post a Comment