If I'm not mistaken XStream takes a similar approach so I suppose it's ok.
/Johan
2009-11-26 Rickard Öberg wrote:
Hi,
>
>I've found an issue with ValueComposite serialization. Basically, if you
>have a base ValueComposite type Foo and then subclass it with CustomFoo,
>then if a field references the base type Foo then that is what is going
>to be used for serialization/deserialization, even if the actual value
>is a CustomFoo. Basically the Value will be downgraded to Foo, no matter
>what.
>
>The solution I'm going with now is to check during serialization whether
>the value actually is Foo, and if not, then I add a JSON field "_type"
>which has the classname of the value. During deserialization I check for
>"_type", and if available I use that.
>
>I've added checks to ValueSerializationTest for this, and it seems to
>work ok. Does this sound like an ok fix to everyone? The normal case is
>still not to include any type info during deserialization. It's only if
>the expected type doesn't match the actual one that the _type will be
>included.
>
>/Rickard
>
>_______________________________________________
>qi4j-dev mailing list
>[email protected]
>http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
>
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev