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

  • 相关阅读:
    Android中的进程
    简单解析三种JAVA调用方式-同步,异步,回调
    Android BroadCastReceiver介绍
    Android 消息处理机制-Looper,Handler,MessageQueue
    Android onPause 和onSaveInstanceState
    Android finish后没有执行 onDestory()
    自定义Linearlayout
    python学习笔记一
    笔试题目汇总
    互联网_http协议
  • 原文地址:https://www.cnblogs.com/joke0406/p/10906391.html
Copyright © 2011-2022 走看看