Serializing versus overriding toString()
When a node overrides toString() and the topology is exported (serialized), the content returned by toString() is used in the format and the file cannot be re-imported afterwards. This is true, at least, for the plain format.
We should probably use the node ID instead of the content returned by toString() in the exportation.
I agree with the fact that there is something to be improved here. I had a similar issue with the PlainTopologySerializer and a toString() with a "[ID] bar" pattern.
Beyond simply using the node ID, which is not necessarily unique, a more flexible mechanism could be provided.
For example, without having thought too much about this, something like overriding a String onSerialize() or a
String onSerialize(Serializer) method might help.
The default behavior would be to return the String value of getID().
For now, I suggest adopt the default behavior that your mention: returning the String value of getID().
I agree that an additional layer of abstraction might help in some cases, but the use of non-unique identifiers is pretty rare. For now, I don't think the need deserves complexifying the API.