Thanks Dan.

Same here, but if I recall correctly the Memento class was originally designed as a holding object in its own right and we subsequently added the ability to encode it.

What I found yesterday was that the contained Data classes weren't public so the decoder couldn't create new instances.

I need to push on and find a quick solution, but I think we should review this stuff as similar things are done elsewhere in the system (but with slightly different needs) using very similar code.

Regards
Rob


On 25/03/11 07:24, dan haywood wrote:
Hi Rob,

I haven't touched this code in quite a while, but I do recall refactoring it
while writing the book for the client/server stuff.  I didn't change its
overall architecture, rather it was more about restructuring it so that the
responsibilities were a little clearer and the generated logging a little
easier to grok (I wanted to see understand the payloads being sent between
client and server).  As you say, it's used in a few other places too, most
notably Memento.  I'm not aware of any bugs in it - there are lots of good
unit tests under EncodabilityContractTest - but if there are some, then we
should fix it.

In terms of the design of this class, it's pretty much hardwired to writing
in binary format, because it's gonna serialize through the provided
java.io.DataOutputStream.  But the interface it implements,
org.apache.isis.core.commons.encoding.DataOutputExtended makes no such
assumptions.  It seems to me that you could easily write a
DataOutputExtendedUsingJson implementation.  I think the design of a JSON
implementation ought to follow the design of the existing
DataOutputStreamExtended, in terms of delegating to its equivalent of
FieldType, eg FieldTypeForJson.

By the way, we probably ought to rename DataOutputStreamExtended ->
DataOutputExtendedUsingBinaryStream, and FieldType to FieldTypeBinary or
something similar.  But don't do it just yet, please... I'm working on a
commit and don't want to get conflicts.

HTH,
Dan



On 24 March 2011 20:19, Robert Matthews<[email protected]>  wrote:

Has anyone (specifically Dan) made use of the Memento class and, in
particular, the encode/decode methods?

What about the DataOutputStreamExtended class and its converse.  Is anybody
making use of that?

I'm not seeing the encoding/decoding work successfully.  Dan, maybe we
could discuss its design a bit. I could do ideally with a JSON
representation that could be stored on a web page.

Rob




Reply via email to