RFE - add generic accessors to SQLInput, SQLOutput

Lance Andersen Lance.Andersen at oracle.com
Sun Jan 13 14:17:06 UTC 2013


I. Will enter a feature request but I do not plan on a change for this release

Best
Lance

--

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com

Sent from my iPhone

On Jan 13, 2013, at 8:20 AM, Ulf <Ulf.Zibis at CoSoCo.de> wrote:

> Hi,
> 
> because bugparade is not working, I post this here :-(
> 
> There could be:
> 
> public <T> T read() throws SQLException;
> public <T> void write(T obj) throws SQLException;
> 
> Alternatively, maybe readObject(), writeObject() could be re-engineered with generic API.
> 
> All other methods then could be deprecated !
> 
> E.g. in javax.sql.rowset.serial.SQLInputImpl the code simply could be:
> (private getNextAttribute() could be dropped)
> 
>    // rename Object[] attrib to attribs !!!
> 
>    public <T> T readObject() throws SQLException {
>        if (++idx >= attribs.length) {
>            throw new SQLException("SQLInputImpl exception: Invalid read " +
>                                   "position");
>        }
>        Object attrib = attribs[idx];
>        lastValueWasNull = attrib == null;
>        if (attrib instanceof Struct) {
>            ...
>            ...
>            ...
>        }
>        return (T)attrib;
>    }
> 
> 
> -Ulf
> 



More information about the core-libs-dev mailing list