An ObjectSwapper (
ObjectDumper or
ObjectLoader) does not send messages directly to the object to be swapped (loaded or unloaded). Instead, it uses an
ObjectReplacer as an intermediary. The public API is between
ObjectReplacers and
ObjectSwappers (an
ObjectReplacer may need to send messages back to the
ObjectReplacer). An
ObjectReplacer interacts with the object to be swapped through the
Strategy, using a public API. Messages between the strategy and target objects can be defined by new applications.
The Swapper framework comes with a predefined set of ObjectReplacers. For most of the cases (such as new classes added by the user, which need a special replacement when loaded or unloaded), just redefining messages that strategies use to interact with the target object (to be loaded/unloaded) is sufficient. This is described in
Object replacement. Advanced users may want to define their own
ObjectReplacers or
Strategies. For that, they must respect the API between an
ObjectSwapper and an
ObjectReplacer, and between these and
Strategies. The messages between
Strategies and target objects are defined by the application.