add generic accessors to SQLInput, SQLOutput (original) (raw)
Ulf Ulf.Zibis at CoSoCo.de
Sun Jan 13 13:20:29 UTC 2013
- Previous message: Can't report bug
- Next message: RFE - add generic accessors to SQLInput, SQLOutput
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
because bugparade is not working, I post this here :-(
There could be:
public T read() throws SQLException; public 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
- Previous message: Can't report bug
- Next message: RFE - add generic accessors to SQLInput, SQLOutput
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]