문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
java:jackson [2019/02/07 19:57] kwon37xi |
java:jackson [2019/02/28 15:46] kwon37xi [@JsonCreator] |
||
---|---|---|---|
줄 23: | 줄 23: | ||
* 해당 클래스 JSON 문자열을 받아서 객체를 생성할 때 변환기를 직접 만들고자 할 때 구현한다. | * 해당 클래스 JSON 문자열을 받아서 객체를 생성할 때 변환기를 직접 만들고자 할 때 구현한다. | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | <code java> | ||
+ | public class Customer { | ||
+ | private String id; | ||
+ | private String name; | ||
+ | private String address; | ||
+ | |||
+ | public Customer() { | ||
+ | } | ||
+ | |||
+ | @JsonCreator | ||
+ | public Customer( | ||
+ | @JsonProperty(" | ||
+ | @JsonProperty(" | ||
+ | @JsonProperty(" | ||
+ | System.out.println(" | ||
+ | this.id = id; | ||
+ | this.name = name; | ||
+ | this.address = address; | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | public String toString() { | ||
+ | return " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
===== Performance ===== | ===== Performance ===== | ||
* [[http:// | * [[http:// | ||
줄 110: | 줄 136: | ||
* [[https:// | * [[https:// | ||
* String 필드게 JSON 문자열이 저장돼 있을 경우 이를 JSON 으로 간주하고 리턴 | * String 필드게 JSON 문자열이 저장돼 있을 경우 이를 JSON 으로 간주하고 리턴 | ||
+ | * 직렬화에서는 작동하지만 역직렬화에서는 작동하지 않는다. | ||
+ | * [[https:// | ||
줄 125: | 줄 153: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// |