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){...}

  • 相关阅读:
    DB2完美卸载
    protobuf2.5 iphone5s中崩溃的问题
    由fprintf和printf看C语言三种标准流
    AIR加载PDF
    使用二叉堆实现优先队列
    11636
    apache archiva安装教程
    WP独立文件资源字典
    常用软件架构模式(收集)
    MATLAB——单层感知器
  • 原文地址:https://www.cnblogs.com/joke0406/p/10906391.html
Copyright © 2011-2022 走看看