Hey,

For value serialization I've implemented Michaels suggestion to use JSON, and have also opted to use plain names instead of hashes for now. So, instead of:

Rickard Öberg wrote:
<pcqEnW7hSlF-uZQFaAwnglkPfxe4/>
<pHC1fHU6i-WoHt6SwiIITETg4OeU><list></list></pHC1fHU6i-WoHt6SwiIITETg4OeU>
<pyl71lJnuDnp_NiusytLDMQfgR9U></pyl71lJnuDnp_NiusytLDMQfgR9U>
<p9DDT42ejJG4hdAYky7gt-StQofE></p9DDT42ejJG4hdAYky7gt-StQofE>
<p4UsCraqBNWR7E3nAM6eRE7YukRI><list>
<item>
<pK1aNaBM9vbnHpQ8fhkA_Vmb9v8M></pK1aNaBM9vbnHpQ8fhkA_Vmb9v8M>
</item>
</list>
</p4UsCraqBNWR7E3nAM6eRE7YukRI>
<pNNLfKkDxQt2WNCYyW7U5EULzRig>42</pNNLfKkDxQt2WNCYyW7U5EULzRig>

it will look something like this:
{another:{val1:"Foo"},anotherList:[{val1:""}],number:42,other:"",some:"",xyzzyList:[]}

which is certainly prettier to look at, and quite compact too. So, essentially the methods to use this are:
void EntityState.setProperty(statename, json);
String getProperty(statename);

So the only thing the entitystore has to be able to handle is JSON strings. Serializable objects are serialized, BASE64'ed, and then turned into JSON strings, so even that works.

To encode/decode JSON I have added methods for it directly in ValueType, so it can be done easily from anywhere. Mostly it will simply be done internally in EntityPropertyInstance get/set though.

Serialization is implemented using StringBuilder and parsing is done with a custom version of StringTokenizer (the original in the JDK doesn't have token peeking, which is essential for list parsing).

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to