You use a CustomFieldSerializer to define custom serialisation and deserialisation for an object.
It’s ostensibly easy to define custom serialization for your class Xxx:
- create a class called
Xxx_CustomFieldSerializerthat extendsCustomFieldSerializer<Xxx>, - implement abstract methods
serializeInstanceanddeserializeInstance, and optionallyinstantiateInstance.
This generates a gazillion compile errors that boil down to the following:
subtype Custom Field Serializer 'Xxx_CustomFieldSerializer' does not define a deserialize method: 'public static void deserialize(SerializationStreamReader reader,Xxx instance)' (reached via Xxx)'
It wants you to create static methods that do exactly what the implemented methods do. Obviously one delegates to the other, but it means you can’t extract out all of this boilerplate for similar types Xxx.
Why? Is this just left over from an old version of GWT or something? Is there a way to avoid having to write all the extra stuff?
Thanks to Thomas Broyer for finding this. It’s just a limitation in GWT.
See:
com.google.gwt.user.rebind.rpc.CustomFieldSerializerValidatorSee: http://code.google.com/p/google-web-toolkit/issues/detail?id=7331&thanks=7331&ts=1335182609