Pluggable load/save mechanism

For a game with a fairly complex data structure, I want to make loading and saving pluggable, i.e. I want to have a single entry point for loading and saving to which I can pass a Serializer/Deserializer object which implements an appropriate interface.

In that way, it would be easy to switch, for example, from one file format to another.

Now, saving and loading cannot easily be designed in an abstract way, as they have to know about/have access to all the classes and their fields.

The solution I came up with is thus:

Each class implements a getSerializer(SerializerFactory sf) and getDeserializer(DeserializerFactory df) method defined in an interface. A GameStateSerializer traverses the data tree, retrieves the specific object Serializers and asks them to save the object state.

The SerializerFactory and DeserializerFactory parameters allow to pass factory objects which may be asked to provide serializers and deserializers for primitive data types.

In this way, the logic for loading and saving is isolated from the classes to be saved and loaded (similar to the Memento pattern), and the factories allow to plug in different file formats.

Does that make sense? Any better ideas? How do you do it?