コード例 #1
0
 public Paging<T> convert() {
   if (this.result == null || result.getList().isEmpty()) {
     return this.result;
   }
   int index = 0;
   for (T bean : result.getList()) {
     S source = this.paging.get(index);
     ConverterContext.convert(bean, source);
     index++;
   }
   return this.result;
 }
コード例 #2
0
  public PagingConvert(Paging<S> paging, Class<T> clazz) {
    this.paging = paging;
    if (paging != null) {
      result = new PagingImpl<T>(paging);
      for (S source : paging.getList()) {
        String json = ConvertJson.toJson(source);
        // System.err.println("json:" + json);
        T target = ConvertJson.toObject(json, clazz);

        try {
          this.fill(source, target);
        } catch (Exception e) {
          throw new RuntimeException(e.getMessage(), e);
        }
        FillerContext.fill(source, target);
        result.add(target);
      }
    }
  }