@Path("d3")
@RequestScoped
public class D3Resource {
@GET
@Path("json")
@Produces(MediaType.APPLICATION_JSON)
public List<D3Bean> getJson() throws Exception {
... (略) ...
return list;
}
...
}
@XmlRootElement(name = "d3")
public class D3Bean {
private Date date;
private int freq;
public D3Bean() {
super();
}
public D3Bean(Date date, int freq) {
this();
this.date = date;
this.freq = freq;
}
@XmlElement
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@XmlElement
public int getFreq() {
return freq;
}
public void setFreq(int freq) {
this.freq = freq;
}
}
@Data
@NoArgConstructor
@XmlRootElement(name = "d3")
@XmlAccessorType(XmlAccessType.FIELD) // UPDATE: Need this
public class D3Bean {
@XmlElement
private Date date;
@XmlElement
private int freq;
}
うん OK !