Uploaded image for project: 'Commons DbUtils'
  1. Commons DbUtils
  2. DBUTILS-82

Change BeanListHandler to be able to handle to list of the bean's super class or interface

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.3
    • 1.7
    • None

    Description

      BeanListHandler handles to list of the bean class itself only.
      If want list of the bean's base class or interface, two steps of cast are needed.

      // Bean is super class or interface of BeanImpl
      BeanListHandler<BeanImpl> blh = new BeanListHandler<BeanImpl>(BeanImpl.class);
      List<BeanImpl> beanImplList = queryRunner.query(sql, blh);
      List<Bean> beanList = (List<Bean>) ((List<?>) beanImplList);
      

      I want to change BeanListHandler to be able to handle to list of the bean's super class or interface;

      // Bean is super class or interface of BeanImpl
      BeanListHandler<Bean> blh = new BeanListHandler<Bean>(BeanImpl.class);
      List<Bean> beanList = queryRunner.query(sql, blh);
      for (Bean bean : beanList) {
          assert bean == null || bean.getClass() == BeanImpl.class;
      }
      

      Attachments

        1. DBUTILS-82.patch
          6 kB
          Kenshi Toriumi

        Activity

          People

            thecarlhall Carl Franklin Hall
            toriken Kenshi Toriumi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: