commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Hall (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DBUTILS-82) Change BeanListHandler to be able to handle to list of the bean's super class or interface
Date Sun, 26 Apr 2015 16:55:39 GMT

     [ https://issues.apache.org/jira/browse/DBUTILS-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Carl Hall updated DBUTILS-82:
-----------------------------
    Fix Version/s: 1.7

> Change BeanListHandler to be able to handle to list of the bean's super class or interface
> ------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-82
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-82
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Kenshi Toriumi
>            Assignee: Carl Hall
>            Priority: Minor
>             Fix For: 1.7
>
>         Attachments: DBUTILS-82.patch
>
>
> 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.
> {code:borderStyle=solid}
> // 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);
> {code}
> I want to change BeanListHandler to  be able to handle to list of the bean's super class
or interface;
> {code:borderStyle=solid}
> // 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;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message