public interface PdxSerializable
toData
provides the serialization code and fromData
provides
the deserialization code. These methods also define each field name and field type of the PDX.
Domain classes should serialize and deserialize all its member fields in the same order in toData
and fromData method. Also fromData and toData must read and write the same fields each time they
are called. A domain class that implements this interface must also have a public zero-arg
constructor which is used during deserialization.
Simple example:
public class User implements PdxSerializable { private String name; private int userId; public User() {} public void toData(PdxWriter out) { out.writeString("name", this.name); out.writeInt("userId", this.userId); } public void fromData(PdxReader in) { this.name = in.readString("name"); this.userId = in.readInt("userId"); } }
Modifier and Type | Method and Description |
---|---|
void |
fromData(PdxReader reader)
Deserializes the PDX fields using the given reader.
|
void |
toData(PdxWriter writer)
Serializes the PDX fields using the given writer.
|