Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm trying to get a custom serializer to serialize a custom class in a custom class but I keep getting stuck on the SerrializeAttribute method. The SerializeRoot gets called 1st, and I have it calling the SerializeAttribute once for each property of my other custom classes. What I think I'm missing is a means to call a method that can will continue the serialization without me having to serialize from my root object all the way up manuallybut I cant see how to do that.
- Does anyone have an example of a custom serializer that can serialize 2 classes like the following
- TClass2 = class
- private
- FString;
- public
- property Data: string read FString write FString;
- end;
- TClass1 = class
- private
- FOtherClass: TClass2;
- public
- property OtherClass: TClass2 read FOtherClass;
- end;
- I can code the serializer for TClass1, but what should the serializer of TClass1 do when it tries to serialize its member OtherClass ?
- I'm thinking that TClass1 serializer is only meant to concern itself with itself and not TClass2. It would probably do somethiong like
- aSerializerObject := TJDOJSONObject.Create;
- (aSerializerObject as TJDOJSONObject).O['OtherClass'];
- which defines the property as null and returns and that the serializing engine can continue it's process but I havent been able to figure out how.
- In the pastebin sample, my problem is in TTestRecordSerializer.SerializeRoot there I call the attibute serializer which I'm sure is coded wrong.
- Sorry about this long post, but it's difficult to explain and I doubt I have explained it enough.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement