NeoJSON mapping in port to GemStone

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

NeoJSON mapping in port to GemStone

Richard Sargent
Administrator
I am porting the latest version of NeoJSON to GemStone and I have come across a mapping problem. I know the brute force solution, but it does put a brutish burden on developers trying to use it.

GemStone 3.6 has a number of "Small" classes which fully encode the value in the OOP.
1: SmallDate
2: SmallDateAndTime
3: SmallFraction
4: SmallDouble
5: SmallFloat
6: SmallInteger
7: SmallScaledDecimal
8: SmallTime

The Number subclasses are all automatically taken care of, but Date, Time, and DateAndTime are problematic. I would like to avoid having programmers explicitly defining custom mappings for each of these classes *and* their regular brethren.

Sven, I am specifically hoping you can jump in and discuss this.

I have one possible suggestion, inspired by #species, and that is have NeoJSONWriter>>#writeObject: use self mappingFor: anObject neoJsonClass rather than just the plain #class. The default implementation of #neoJsonClass would answer the receiver's class. And those places where one needs them can provide their own answer. e.g. SmallDate>>#neoJsonClass would answer Date, and so on.

Of course, if there is a better way, I would love to learn it.

Thanks!
-- Richard