是有可能在使用傑克遜註釋JsonIgnore
的示例值忽略lastUpdate
。
import com.fasterxml.jackson.annotation.JsonIgnore;
public class Phone {
private String phoneNumber;
private String lastUpdate;
private int status;
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
@JsonIgnore
public String getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate() {
this.lastUpdate = lastUpdate;
}
public int getStatus() {
return lastUpdate;
}
public void setStatus() {
this.status = status;
}
}
試試這個http://stackoverflow.com/a/27779319/1754020 –