You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stas Agarkov (JIRA)" <ji...@apache.org> on 2010/06/04 08:18:53 UTC

[jira] Created: (DBUTILS-69) Change generic type from Object to T

Change generic type from Object to T
------------------------------------

                 Key: DBUTILS-69
                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
             Project: Commons DbUtils
          Issue Type: Improvement
    Affects Versions: 1.3
            Reporter: Stas Agarkov
             Fix For: 1.3


Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DBUTILS-69) Change generic type from Object to T

Posted by "Stas Agarkov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stas Agarkov updated DBUTILS-69:
--------------------------------

    Attachment: ColumnListHandler.patch

patch, which changes the generic type from Object to T

> Change generic type from Object to T
> ------------------------------------
>
>                 Key: DBUTILS-69
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Stas Agarkov
>             Fix For: 1.3
>
>         Attachments: ColumnListHandler.patch
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DBUTILS-69) Change generic type from Object to T

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875568#action_12875568 ] 

Sebb commented on DBUTILS-69:
-----------------------------

The patch generates two warnings from the method handleRow(ResultSet):

Unchecked cast from Object to T

Is it guaranteed that ResultSet.getObject(int) will always return a T?

What problem does the patch try to address?

> Change generic type from Object to T
> ------------------------------------
>
>                 Key: DBUTILS-69
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Stas Agarkov
>             Fix For: 1.3
>
>         Attachments: ColumnListHandler.patch
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DBUTILS-69) Change generic type from Object to T

Posted by "Stas Agarkov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875583#action_12875583 ] 

Stas Agarkov commented on DBUTILS-69:
-------------------------------------

I think it is better to encapsulate a suspicious cast in the library than to write in each application instead:
phones = (Collection <String>) queryRunner.query (query, new ColumnListHandler ());
line:
Object object = queryRunner.query (query, new ColumnListHandler ());
phones = (Collection <String>) object;

> Change generic type from Object to T
> ------------------------------------
>
>                 Key: DBUTILS-69
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Stas Agarkov
>             Fix For: 1.3
>
>         Attachments: ColumnListHandler.patch
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DBUTILS-69) Change generic type from Object to T

Posted by "Julien Aymé (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875594#action_12875594 ] 

Julien Aymé commented on DBUTILS-69:
------------------------------------

I think that in order to do what you want, you will need to implement a new StringColumnListHandler class, which will call rs.getString method instead of rs.getObject.
You just have to copy the ColumnListHandler code, and change it as you want.

This way, no cast would be required, and the list will contain only String (since ResultSet#getString method is used).

It is safer to leave the current implementation as is, since there is no way to know for sure the type returned by the getObject method.

> Change generic type from Object to T
> ------------------------------------
>
>                 Key: DBUTILS-69
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Stas Agarkov
>             Fix For: 1.3
>
>         Attachments: ColumnListHandler.patch
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DBUTILS-69) Change generic type from Object to T

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved DBUTILS-69.
-------------------------

    Fix Version/s:     (was: 1.3)
       Resolution: Won't Fix

If you want to suggest a StringColumnListHandler class, please open a new improvement request

> Change generic type from Object to T
> ------------------------------------
>
>                 Key: DBUTILS-69
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-69
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Stas Agarkov
>         Attachments: ColumnListHandler.patch
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> Please change generic type from Object to T in the class ColumnListHandler.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.