Original Post
So I got a bit of dilemma here, wanted you guys' input on coming up w/ an elegant solution... I have objects which make use of the State pattern for their behavior. These objects are also made to be serializable. The problem arises in that through serialization the objects need to maintain some kind of reference to which state object they should use, however the state objects themselves should not be serialized, as they are singletons. Does this make sense? I've developed one or two solutions involving enums and proxy's, however none of them seem very elegant. Can anyone present a clean solution to this dilemma?