Monday, May 7, 2007

Serializing and deserializing objects with FDS

I was running into a problem with synchronizing objects which include child objects. The log files in the java classes returned fully filled object including child objects. However, when the sames objects came over to the Actionscript client side, the child object were in there initial state as shallow objects.

Several tries later and with the help of John Zhao from Abode, it turned out that the java classes need to be implemented as Serializable.


package com.grendel.java.data;
import java.io.Serializable

public class Person inplements Serializable
{
public int personId;
public Contact contact;

public Person () { super();}
}
package com.grendel.java.data;
import java.io.Serializable;

public class Contact inplements Serializable
{
public int contactId;
public String contact;
public Contact () { super();}
}

If you instantiate the Person class in the PersonAssembler or on the client the Contact child class will be serialized and deserialized during synchronization.

No comments: