zoukankan      html  css  js  c++  java
  • 公共文件下载-结构设计

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

    class FileDownloadService

      @Autowired
      private ApplicationContext applicationContext;

      private IDownloadService downloadService;

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

      this.downloadService.download(req);

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

    abstract class AbstractB<T,K>

      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);

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

    class AService

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

  • 相关阅读:
    js中的单例模式
    node.js
    vscode设置
    Array.from();Object.keys();Array.map()
    js题
    如何申请成为企业微信,并成为第三方服务商
    微信企业号第三方平台应用开发
    SQL Server 给表和字段添加说明
    sql 语句写的行列转换
    不同数据库之间复制表的数据的方法
  • 原文地址:https://www.cnblogs.com/joke0406/p/10906391.html
Copyright © 2011-2022 走看看