I have a model (MVC) class whose internal state (which basically contains of private int
fields) I want to store.
The program is running on Android (for now) so I need to store the in a Bundle
, but I'll be using the same class later in a desktop application where I'll have to store the state some other way, so I can't reference Bundle
directly in my class.
So my question is: What is the best way to store (and retrieve) the state of a class without exposing it's implementation?
The best I could think of removing the private
access modifier so that the fields become package accessible and create read/write helper classes in the same package, but that somehow seems wrong.