On 13 May 2013 22:16, sebb <[email protected]> wrote: > On 10 May 2013 21:23, William Speirs <[email protected]> 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: [email protected] For additional commands, e-mail: [email protected]
