Jackson JSON Marshall은 getter를 무시합니다.
잭슨을 사용하여 POJO를 JSON으로 변환하여 DB에 저장합니다.하지만 나는 무시하고 싶은 게 있다.@JsonIgnoreProperties에 관한 많은 정보를 보고 있습니다만, 진척이 없는 것 같습니다.기본적으로는 @Transient와 동등한 것을 원합니다.
기본 사용 사례(International Number를 무시합니다):
public class PhoneNumber {
private String country;
private String number;
public PhoneNumber() {}
public String getCountry() {
return country;
}
public String getLocalNumber() {
return localNumber;
}
public String getInternationalNumber() {
String result = "Not Available";
if (country != null && localNumber != null) {
result = new PhoneNumberHandler().internationalFormat(
localNumber, WorldCountries.countryToIso2Code(country));
}
return result;
}
}
그것은 getter method일 것이다.
언급URL : https://stackoverflow.com/questions/13533629/jackson-json-marshall-ignore-getter
'programing' 카테고리의 다른 글
JsonParser는 더 이상 사용되지 않습니다. (0) | 2023.02.23 |
---|---|
여러 인라인 스타일 개체를 결합하려면 어떻게 해야 합니까? (0) | 2023.02.23 |
Angular Http - 약속 또는 구독 (0) | 2023.02.23 |
$window 또는 $location을 사용한 각도 리다이렉트JS (0) | 2023.02.23 |
$.ajax 유틸리티의 JQuery 오류 옵션 (0) | 2023.02.23 |