I spent my flight over Java writing DBJavaObject in Java making DBJavaObject the most Java thing I've done.
I was meant to be writing the JavaDocs on DBNumber, but I noticed some problems when I was documenting DBLargeObject.
In particular there was only one subclass of DBLargeObject when I was certain that there should be 2. The second should have been DBJavaObject, the one that stores actual objects in the database, but it directly sub-classed QueryableDatatype. Also it looked too terse to actually be working.
Still I had a convention to go to, clothes to pack, and a million other things to worry about. So it got put aside while life intervened. Presumably for at least the second time.
Once I was on the flight however, it came back to haunt me. And Auckland to Singapore gives a programmer lots of time to think. Which was good really since doing a good implementation turned out to be trickier than I'd expected. Inheritance got in the way, generics clashed with specifics, and common interfaces refused to make sense.
Fortunately most of these problems cracked under the strain of a bored and tired software engineer drinking too much coffee because sleeping is painful in planes.
The good news is that DBJavaObject now works like you'd expect: add a generic to the DBJavaObject and you get the generic back.
DBJavaObject<String> dbJavaObject = new DBJavaObject<String>(); ... String returnedObject = row.dbJavaObject.getValue();
Now it is as easy to store a HashMap, di-graph, or custom object as it is to store an integer. And it's thanks to the JavaDoc Analyser and a plane flight over Java :-D
Anonymous