Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

implements CustomResponse 하는 class 를 하나 작성한다.

subList : apiConfig 동작의 응답 결과 리스트

Code Blockcode
languagejava
@Component("sampleResponse")
public class SampleResponse implements CustomResponse {
    @Override
    public List<QueryResult> execute(QueryContext queryContext, List<QueryResult> subList) {
        int idx = 1;

        //subList : apiConfig 동작의 응답 결과 리스트
        
        for(QueryResult item : subList){
          item.put("idx", idx++);
        }

        return subList;
    }

    @Override
    public Map<String, Object> execute(ReadContext readContext, Map<String, Object> itemResult) {

        return itemResult;
    }
}

...