Per class custom serialization in GWT

Need to do custom RPC serialization for a class in GWT?

Here’s how. E.g. for the class my.example.MyObject create a class named my.example.MyObject_CustomFieldSerializer. And then implement

    public static void serialize(SerializationStreamWriter streamWriter, MyObject myObject)
        throws SerializationException {}

    public static void deserialize(SerializationStreamReader streamReader, MyObject myObject)
        throws SerializationException {}

    //This method is optional
    public static MyObject instantiate(SerializationStreamReader streamReader)
        throws SerializationException {}

For more info, see CustomFieldSerializer (somehow this page didn’t show up when I googled for it, only after I knew the term was CustomFieldSerializer).

©2006 - 2010 Rintcius Blok