Hey,
Since we went for changing stored properties into always being strings,
when the value is a ValueComposite we need to have a persistent format
for that. I've made a quick hack that uses XML for it, and it looks
something like this.
These values:
public interface SomeValue extends ValueComposite
{
@UseDefaults @MaxLength(5)
Property<String> some();
@UseDefaults
Property<String> other();
@UseDefaults
Property<List<String>> xyzzyList();
@Optional
Property<AnotherValue> another();
@UseDefaults
Property<List<AnotherValue>> anotherList();
}
public interface AnotherValue extends ValueComposite
{
@UseDefaults
Property<String> val1();
}
Result in the following persistent format:
<vorg.qi4j.api.value.ValueCompositeTest-SomeValue>
<pcqEnW7hSlF-uZQFaAwnglkPfxe4/>
<pHC1fHU6i-WoHt6SwiIITETg4OeU><list></list></pHC1fHU6i-WoHt6SwiIITETg4OeU>
<pyl71lJnuDnp_NiusytLDMQfgR9U></pyl71lJnuDnp_NiusytLDMQfgR9U>
<p9DDT42ejJG4hdAYky7gt-StQofE></p9DDT42ejJG4hdAYky7gt-StQofE>
<p4UsCraqBNWR7E3nAM6eRE7YukRI><list>
<item><vorg.qi4j.api.value.ValueCompositeTest-AnotherValue>
<pK1aNaBM9vbnHpQ8fhkA_Vmb9v8M></pK1aNaBM9vbnHpQ8fhkA_Vmb9v8M>
</vorg.qi4j.api.value.ValueCompositeTest-AnotherValue></item>
</list>
</p4UsCraqBNWR7E3nAM6eRE7YukRI>
<pNNLfKkDxQt2WNCYyW7U5EULzRig>42</pNNLfKkDxQt2WNCYyW7U5EULzRig>
</vorg.qi4j.api.value.ValueCompositeTest-SomeValue>
As you can see this exercices both primitives, strings, collections
(list) and references to other values. The strange XML names comes from
the schema version of the property name (hash of name+package+type) so
that we can know if the property value is supposed to be a string, long
or something else. In other words, it will require the PropertyType that
was used to create it in order to read it. How to manage this is an open
question. For persistent entities there is an EntityTypeRegistry service
that is supposed to do this.
Does this format look ok, or would you like to change it? Should the
value classname be replaced with the hash of it too?
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev