commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [DBUTILS] Generic ArrayHandler (was: Pre RC for DBUTILS-2.0)
Date Mon, 13 May 2013 21:44:13 GMT
On 13 May 2013 22:16, sebb <sebbaz@gmail.com> wrote:
> On 10 May 2013 21:23, William Speirs <wspeirs@apache.org> wrote:
>> Consider this a pre release candidate for DBUTILS-2.0. I fixed the
>> following things from RC1:
>>
>> - Removed @author tags
>> - Changed QueryRunner to be public
>> - Made ArrayHandler generic (but it's ugly because I just cast to T[], does
>> anyone have a better idea here?)
>
> Why not change the interface method? i.e. change
>
> Object[] RowHander.toArray(ResultSet rs)
> to be
> T[] RowHander.toArray(ResultSet rs, Class<T>)
>
> The toBean methods in the interface require the class to be provided
>
> Indeed, why not also change the other method?
>
> Map<String, Object> toMap(ResultSet rs)
> to
> Map<String, T> toMap(ResultSet rs, Class<T>)

Scrap that - not sure either makes sense.

AFAICT in general a ResultSet can only be converted into an array of Object.
For some sets, there might be a more specific type, for example
Number, but in general the only common super-class will be Object.

I therefore wonder why ArrayHandler should be generic in the first place?
If an application knows that there is a more specific common
supertype, then it can do the cast itself.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message