Czy znacie jakiś przystojny sposób aby pobierać tylko te getter z klasy które nie są nullem?
Mam taki np przykładowy response:
{
totalIncome:0,
totalQty:null,
trans:null,
withCommentsIncome:null,
withCommentsQty:null,
withNoCommentsIncome:null,
withNoCommentsQty:null
}
Chciałbym aby to było robione dynamicznie i pobierało tylko te pola które nie są null.
Klasa:
package pl.bpo.archiwumallegro.model.allesuma;
public class SummaryField {
Long income;
Long totalQty;
Long totalIncome;
Long grossIncome;
Long soldItems;
Long trans;
Long auctions;
Long items;
Long auctionsByTrans;
Long withCommentsIncome;
Long withNoCommentsIncome;
Long notSalesIncome;
Long withCommentsQty;
Long withNoCommentsQty;
Long notSalesQty;
public Long getIncome() {
return income;
}
public void setIncome(Long income) {
this.income = income;
}
public Long getTotalQty() {
return totalQty;
}
public void setTotalQty(Long totalQty) {
this.totalQty = totalQty;
}
public Long getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(Long totalIncome) {
this.totalIncome = totalIncome;
}
public Long getGrossIncome() {
return grossIncome;
}
public void setGrossIncome(Long grossIncome) {
this.grossIncome = grossIncome;
}
public Long getSoldItems() {
return soldItems;
}
public void setSoldItems(Long soldItems) {
this.soldItems = soldItems;
}
public Long getTrans() {
return trans;
}
public void setTrans(Long trans) {
this.trans = trans;
}
public Long getAuctions() {
return auctions;
}
public void setAuctions(Long auctions) {
this.auctions = auctions;
}
public Long getItems() {
return items;
}
public void setItems(Long items) {
this.items = items;
}
public Long getAuctionsByTrans() {
return auctionsByTrans;
}
public void setAuctionsByTrans(Long auctionsByTrans) {
this.auctionsByTrans = auctionsByTrans;
}
public Long getWithCommentsIncome() {
return withCommentsIncome;
}
public void setWithCommentsIncome(Long withCommentsIncome) {
this.withCommentsIncome = withCommentsIncome;
}
public Long getWithNoCommentsIncome() {
return withNoCommentsIncome;
}
public void setWithNoCommentsIncome(Long withNoCommentsIncome) {
this.withNoCommentsIncome = withNoCommentsIncome;
}
public Long getNotSalesIncome() {
return notSalesIncome;
}
public void setNotSalesIncome(Long notSalesIncome) {
this.notSalesIncome = notSalesIncome;
}
public Long getWithCommentsQty() {
return withCommentsQty;
}
public void setWithCommentsQty(Long withCommentsQty) {
this.withCommentsQty = withCommentsQty;
}
public Long getWithNoCommentsQty() {
return withNoCommentsQty;
}
public void setWithNoCommentsQty(Long withNoCommentsQty) {
this.withNoCommentsQty = withNoCommentsQty;
}
public Long getNotSalesQty() {
return notSalesQty;
}
public void setNotSalesQty(Long notSalesQty) {
this.notSalesQty = notSalesQty;
}
}