Implement getObject method on Row class

Description

Currently there is no ability to get a column value off a Row as an Object. The data type must always be known as a consequence.

While it is possible to do this via a helper method (see https://datastax-oss.atlassian.net/browse/JAVA-173#icft=JAVA-173), with more recent version of the driver this helper requires that the developer also includes the protocol version which does make it a bit less friendly for developers
e.g.
public static Object getObject(Row r, int index, int protocolVersion) {
return r.getColumnDefinitions().getType(index).deserialize(r.getBytesUnsafe(index), protocolVersion);
}

There are situations where the ability to write generic code to handle Rows like this is required and it would be helpful if this was part of the driver.

Environment

None

Pull Requests

None

Activity

Show:

Sylvain Lebresne 
December 15, 2014 at 11:03 AM

I'll note that while I've disagreed with the addition of such method in the past (on the argument that it was easily doable with an helper function), I can admit that having to pass the protocol version makes it a bit more awkward now. So I think I'm now fine with adding this.

Fixed

Details

Assignee

Reporter

Labels

Affects versions

Fix versions

Components

Priority

Created December 12, 2014 at 4:02 PM
Updated April 14, 2015 at 10:18 PM
Resolved March 27, 2015 at 6:20 PM

Flag notifications