An object oriented mechanism is disclosed that allows class replacement that
is
based on a specified processing context by replacing existing configuration data
with new configuration data within an existing object oriented program. The configuration
data is preferably stored in a data structure external to the class definitions
to allow modifying the classes without re-compiling the class code. The configuration
data includes multiple entries, where each entry is a key-value pair. The key includes
information relating to the processing context, and the value includes information
relating to the class that corresponds to the key. When an instance of a class
needs to be created, the context information is retrieved, a key is generated from
a combination of the class information and the context information, and the context-sensitive
key is used to retrieve the corresponding class configuration data from the data
structure that specifies a particular class. An object that is an instance of the
specified class is then created. By generating a key that is context-specific,
configuration data for a class can be scoped to a particular processing context,
thereby providing context-based class replacement.