사용자 도구

사이트 도구


java:jackson:squiggly

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
java:jackson:squiggly [2020/11/23 14:53]
kwon37xi
java:jackson:squiggly [2020/11/25 15:37] (현재)
kwon37xi
줄 4: 줄 4:
   * [[:rest_api|REST API]] 의 Partial Response 를 구현할 수 있다.   * [[:rest_api|REST API]] 의 Partial Response 를 구현할 수 있다.
   * see [[java:jackson:jackson_dynamic_filter|Jackson Dynamic Filter]]   * see [[java:jackson:jackson_dynamic_filter|Jackson Dynamic Filter]]
 +  * [[https://github.com/bohnman/squiggly/tree/master/examples/spring-boot|squiggly - spring-boot example]]
 +
 +===== 특수 필터 =====
 +  * nested 는 ''nestedFieldName[field1,field2]'' 형태.
 +  * ''ctions[user[lastName]]''
 +  * ''%%**%%'' : 전체 필드 강제 선택
 +  * ''*'' : base field 기준으로만 전체
 +  * ''issue*'' : wildcard
 +  * 빈 문자열은 아무 필드도 선택 안함.
 +  * ''~iss[a-z]e.*~'' : regex
 +===== 설정 =====
 +  * classpath root 에 ''squiggly.properties'' 파일로 설정.
 +  * ''SquigglyConfig.asMap()''으로 설정정보 읽기 가능.
 +
 +===== Serializer 사용시 주의 =====
 +  * ''JsonSerializer''에서 ''JsonGenerator'' 사용시 squiggly 가 적용이 안된다.
 +  * ''SerializerProvider''를 사용할 것.
 +<code java>
 +// Works with Squiggly
 +public class TestSerializer extends JsonSerializer<TestObject> {
 +
 +    @Override
 +    public void serialize(TestObject value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
 +        Map<String, Object> map = new HashMap<>();
 +        map.put("a", value.getA());
 +        map.put("c", value.getC());
 +
 +        provider.defaultSerializeValue(map, jgen);
 +    }
 +}
 +</code>
 +
  
 ===== 참조 ===== ===== 참조 =====
   * [[https://dzone.com/articles/dynamically-filter-json-with-jackson-and-squiggly|Dynamically Filter JSON With Jackson and Squiggly - DZone Web Dev]]   * [[https://dzone.com/articles/dynamically-filter-json-with-jackson-and-squiggly|Dynamically Filter JSON With Jackson and Squiggly - DZone Web Dev]]
 +  * [[http://googlecode.blogspot.com/2010/03/making-apis-faster-introducing-partial.html|Making APIs Faster: Introducing Partial Response and Partial Update - The official Google Code blog]]
 +  * [[https://developers.facebook.com/docs/graph-api/using-graph-api/#reading|Facebook Graph API fields 선택]]
 +  * 또 다른 구현 : https://github.com/pa-media-group/partial-response
  
java/jackson/squiggly.1606110787.txt.gz · 마지막으로 수정됨: 2020/11/23 14:53 저자 kwon37xi