我有一个Java Restful
Web服务,当由postman
调用时返回一个缺少属性的对象。下面可以看到JSON
对象。Restful服务不返回对象
下面的图像显示了它刚刚在rest函数中返回之前的对象。正如你所看到的那样,本周的某些日子里有值得注意的东西,邮递员没有看到这些值。
backAbsence
实体可以在这篇文章的末尾查看。
SAbsence
是backAbsence
实体的列表。
我想知道的是为什么当我返回
SAbsenece
是没有收到邮寄的完整模型,我该如何解决它?
[
{
"name": "King sean",
"classidClass": 0,
"studentidStudent": 1,
"week": 14
},
{
"name": "Sean king",
"classidClass": 0,
"studentidStudent": 2,
"week": 14
}
]
休息功能部分:
@GET
@Produces({"application/xml","application/json"})
@Path("{id}/{option}")
public List<BackAbsence> findbyClass(@PathParam("id")int id,
@PathParam("option")int option) {
List<BackAbsence> SAbsence = new ArrayList<>();
// code here fills list. The Image above shows the object with valid attributes
return SAbsence;
}
}
BackAbsnece实体:
public class BackAbsence {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private int classidClass;
private int studentidStudent;
private int monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0;
private int week;
public BackAbsence() {
}
public BackAbsence(int idstudent, String name) {
this.studentidStudent = idstudent;
this.name = name;
}
public BackAbsence(int classidClass, int studentidStudent, int monday, int tuesday, int wednesday, int thursday, int friday,int week) {
this.classidClass = classidClass;
this.studentidStudent = studentidStudent;
this.monday = monday;
this.tuesday = tuesday;
this.wednesday = wednesday;
this.thursday = thursday;
this.week = week;
}
public int isMonday() {
return monday;
}
public void setMonday(int monday) {
this.monday = monday;
}
public int isTuesday() {
return tuesday;
}
public void setTuesday(int tuesday) {
this.tuesday = tuesday;
}
public int isWednesday() {
return wednesday;
}
public void setWednesday(int wednesday) {
this.wednesday = wednesday;
}
public int isThursday() {
return thursday;
}
public void setThursday(int thursday) {
this.thursday = thursday;
}
public int isFriday() {
return friday;
}
public void setFriday(int friday) {
this.friday = friday;
}
public int getClassidClass() {
return classidClass;
}
public void setClassidClass(int classidClass) {
this.classidClass = classidClass;
}
public int getStudentidStudent() {
return studentidStudent;
}
public void setStudentidStudent(int studentidStudent) {
this.studentidStudent = studentidStudent;
}
public int getWeek() {
return week;
}
public void setWeek(int week) {
this.week = week;
}
}