package serialize { import logserver.*; public class DefaultSerializer extends SerializerBase { private var counter : int; public function DefaultSerializer () { super(); } override protected function actualReset() : void { counter = 0; } override protected function actualBeginObject(obj : Object, objType : String) : Object { counter ++; var uid : int = counter; WriteLog.log("begin:" + uid + ":" + objType); return uid; // unique id for this object } override protected function actualEndObject() : void { WriteLog.log("end:" + currentToken + ":" + currentObjectType); // + currentObjectType() } override protected function storeFieldPrim(name : QName, val : Object) : void { WriteLog.log("prim:" + name + ":" + val); } override protected function storeFieldRec(name : QName, val : Serializable, prev : *) : void { if (prev == undefined) { if (val == null) { WriteLog.log("rec:" + name + ":null"); } else { WriteLog.log("rec:" + name); val.serializeSelf(this); // recursive call } } else { WriteLog.log("prev:" + name + ":"+ prev); // already serialized } } } }