I am trying to return RemoveHoldPayload
in my API. I noticed that when I used the following getter name isToBeClosedResult
(1) then the response is missing toBeClosedResult
but when I change the getter name to a standard name : getToBeClosedResult
then the variable is getting returned in the response object JSON.
Why is this happening ?
(1) : --------------
{
"autoHolds": null,
"manualHolds": null,
"incidentId": null,
"comment": null,
"commentType": null,
"error": null,
"toBeClosed": false,
"closeStatusCode": 0,
"commentId": null
}
API: -------------
@PostMapping(value = "/dummyAPI")
public Object dummyAPI () throws Exception {
RemoveHoldPayload rh = new RemoveHoldPayload();
return rh;
}
CLASS : -----------
import java.util.List;
public class RemoveHoldPayload {
private List<AggregatedHoldListResource> autoHolds, manualHolds;
private String incidentId, comment, commentType, toBeClosedResult,error;
private boolean toBeClosed;
private short closeStatusCode;
private Integer commentId;
public String getToBeClosedResult() {
return toBeClosedResult;
}
public void setToBeClosedResult(String toBeClosedResult) {
this.toBeClosedResult = toBeClosedResult;
}
public String getIncidentId() {
return incidentId;
}
public void setIncidentId(String incidentId) {
this.incidentId = incidentId;
}
public boolean getToBeClosed() {
return toBeClosed;
}
public void setToBeClosed(boolean toBeClosed) {
this.toBeClosed = toBeClosed;
}
public short getCloseStatusCode() {
return closeStatusCode;
}
public void setCloseStatusCode(short closeStatusCode) {
this.closeStatusCode = closeStatusCode;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public Integer getCommentId() {
return commentId;
}
public void setCommentId(Integer commentId) {
this.commentId = commentId;
}
public String getCommentType() {
return commentType;
}
public void setCommentType(String commentType) {
this.commentType = commentType;
}
public List<AggregatedHoldListResource> getAutoHolds() {
return autoHolds;
}
public void setAutoHolds(List<AggregatedHoldListResource> autoHolds) {
this.autoHolds = autoHolds;
}
public List<AggregatedHoldListResource> getManualHolds() {
return manualHolds;
}
public void setManualHolds(List<AggregatedHoldListResource> manualHolds) {
this.manualHolds = manualHolds;
}
}