例如,我有一个带有 URL 的传入请求:“/cid/{cid}/{action}”
对于路径变量 {action},我可以有两个值,即 {action}:1)列表 2)平铺
我的带有 JSON 输出参数的 POJO 类如下:
public class Area {
private Integer aId;
private String aName;
private Integer allSpaces;
private Integer violated;
private Integer percent;
private Integer level;
private List<Space> space = new ArrayList<Space>(); // this List should be depend on condition
public Area(Integer aId, String aName, Integer allSpaces, Integer violated, Integer percent, Integer level) {
this.aId = aId;
this.aName = aName;
this.allSpaces = allSpaces;
this.level = level;
this.violated = violated;
this.percent = percent;
}
public Integer getaId() {
return aId;
}
public void setaId(Integer aId) {
this.aId = aId;
}
public String getaName() {
return aName;
}
public void setaName(String aName) {
this.aName = aName;
}
public Area addSpace(Space s) {
space.add(s);
return this;
}
public List<Space> getSpace() {
return space;
}
public void setSpace(List<Space> space) {
this.space = space;
}
public Integer getAllSpaces() {
return allSpaces;
}
public void setAllSpaces(Integer allSpaces) {
this.allSpaces = allSpaces;
}
public Integer getViolated() {
return violated;
}
public void setViolated(Integer violated) {
this.violated = violated;
}
public Integer getPercent() {
return percent;
}
public void setPercent(Integer percent) {
this.percent = percent;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
}
我的输出不应该包含action =listprivate List space = new ArrayList()
的参数,而是显示action=tile的参数。
如果有任何机构可以帮助我,这将有很大帮助。