公共文件下载-结构设计

匿名 (未验证) 提交于 2019-12-02 23:34:01

======================================供网关调用==============================================================

class FileDownloadService

  @Autowired
  private ApplicationContext applicationContext;

  private IDownloadService downloadService;

  //获取具体的实现类
  downloadService = applicationContext.getBean(config.getBeanName(), IDownloadService.class);

  this.downloadService.download(req);

===================================================================================================

  void download(){

    ...

    List<T> datas = this.getData(JSONObject.parseObject(download.getDownloadCondition(),this.getQueryClass()));

    ...

  }

 1     /**  2      * 获取查询泛型的类对象  3      * @return  4      */  5     protected Class<K> getQueryClass(){  6         Type t = getClass().getGenericSuperclass();  7         Type[] param = ((ParameterizedType) t).getActualTypeArguments();  8         Class<K> cls = (Class<K>) param[1];  9         return cls; 10     }

  public abstract List<T> getData(K k);

=================================================================================================================

  public List<AVo> getData(ARequest req){...}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!