commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: svn commit: r1205609 - in /commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils: handlers/ handlers/ handlers/ handlers/ScalarHandle
Date Fri, 25 Nov 2011 18:40:57 GMT
On 25 November 2011 17:59, Bill Speirs <> wrote:
> On Fri, Nov 25, 2011 at 12:28 PM, sebb <> wrote:
>>> As we discussed before, this exception will be thrown if the column
>>> type doesn't match the generic type. Because of type erasure I don't
>>> know of any way to validate the types.
>> What determines the column type?
> As far as I know, the column type is determined by the table schema
> for the datbase, and the JDBC driver.
>> If the user codes correctly to the API, is it possible for the CCE to be thrown?
> If the user properly matches the generic with what is in the table
> schema, a CCE should not be thrown.
>> Part of the idea of generics is to do away with unnecessary casts and
>> instanceof checks; adding inappropriate @SuppressWarnings tags negates
>> the benefit (and can even make things worse).
> Because we only have the getObject method (there are other JDBC
> methods; however, we cannot pick the correct method because of type
> erasure), there will need to be a cast. However, this cast is done by
> the library, so the user is not forced to cast.

OK. So we can document as follows (or similar)

* @throws CCE if the class datatype does not match the column type

// We assume that the user has picked the correct type to match the column
// so getObject will return the appropriate type and the cast will succeed.

> Bill-
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message