On Sunday, March 31, 2013 10:49:07 PM UTC+2, Jeff Schnitzer wrote:
>
> When doing custom serialization, is it possible to swap out one class 
> for another? 
>
> This would fix a _lot_ of problems using Objectify's Ref<?> and Key<?> 
> client-side, including, I think, being able to instantiate Refs and 
> Keys intelligently. 
>
> But I have an immediate problem I'm trying to fix - which is that 
> Ref<?> is a class hierarchy on the server side, but I'd really like to 
> simplify this to a single concrete Ref class client-side.  So even 
> though the sever might return StdRef<?> or NullRef<?>, these should be 
> converted to a simplified, concrete Ref<?> on the client side. 
>
> Is this possible?  It would be even better if I could somehow just 
> define one custom serializer that handles all Ref subclasses instead 
> of having to make separate custom serializers for each.
>

I don't think it's possible, because the type signature is written 
independently from the custom serializers, so serializing a StdRef on the 
server-side will put the StdRef type signature in the stream, to be decoded 
on the client-side.
You can however just make StdRef and NullRef "super-source" classes that 
simply inherit from Ref without adding anything, and have their respective 
custom serializers call the Ref_CustomFieldSerializer methods (at least for 
the client-side implementation)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to