[Pharo-dev] [ANN]: Little NeoJSON Helper

Sean P. DeNigris sean at clipperadams.com
Mon Apr 28 11:14:42 EDT 2014


Sean P. DeNigris wrote
> "Assuming Neo-JSON-Core is loaded"
> To aid in writing mappings, send "reader mapHelperFor: MyDomainClass"

I improved the API a bit. Now, the mapping is done via class-side
#addNeoJsonMapTo: aNeoJSONReader.
The default (defined in class) brings up the helper. So now you can write:
    MyClass addNeoJsonMapTo: aNeoJSONReader.

The first time you do this, you will get an inspector on the helper object,
which you still send #generateInstVars.

But for the second step, you now send #generateMapping, which compiles
MyClass class>>#addNeoJsonMapTo: with the necessary mapping.

If you're mapping a collection, you probably have to close the halt debugger
now and restart, because the default behavior of inspecting the helper is
cached in the reader. Otherwise, you can proceed and map the next class.

I like the class side methods because they decompose monolithic mapping
declarations and can be reused.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/ANN-Little-NeoJSON-Helper-tp4756763p4756791.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.




More information about the Pharo-dev mailing list