I have been attempting to find a solution to saving the state of class objects for a couple of days now. I have researched the StateManager as well as the KeyValueStore but they only do simple data plus Types. This morning I looked into JsonGenerator in hopes that this might be a solution but it doesn't look like it does what I need.
A brief example would be a class called Games has a few int and string properties along with a collection (List) of another class called Points. My code currently has a few other classes but lets keep it simple for now. Here are two classes with some of the Class_Globals for each class.
Class Point
sub Class_Globals
private _ServingPlayer as int
private _PointTo as int
end sub
end class
Class Game
sub Class_Globals
private _Score(2) as int
private _ServingTeam as int
private _Points as List ' Contains Point objects
end sub
end class
What I need to do is to save the state of this class using something like StateManager but not sure how to do this with B4A. Normally I would think of doing something like Game.Serialize but it looks like I need do everything manually. Is there a better solution than manually creating the serialize myself? I have thought that maybe I could replace simple classes with just a type but I loose the ability to add support for special handling of the properties in each class then.
I hopes this makes sense. What I'm hoping for is something simple like Game.Serialize() and Game.Deserialize(str) or even Game = XYZ.Deserialize(str)
Thanks for any info/guidenance on this.