我有以下POJO类,其中包含用于所有内容的getter和setter:
public class Trip {
private String name;
private int capacity;
private int id;
private int present;
public Trip(int id, String name, int capacity) {
this.id = id;
this.name = name;
this.capacity = capacity;
this.present = 0;
}
}
返回这些类中的ArrayList
时,仅包含id
,name
和capacity
。 JWS方法如下所示:
@WebMethod
public ArrayList<Trip> getAllTrips(){
// return ArrayList of all trips
}
如何说服present
字段出现在输出XML中?