You have:
- An existing component class that may be unavailable for subclassing.
You want to:
- Attach additional state or behavior to an object dynamically.
- Make changes to some objects in a class without affecting others.
- Avoid subclassing because too many classes could result.
But consider using instead:
- The Adapter pattern, which sets up an interface between different classes.
- The Composite pattern, which aggregates an object without also inheriting its interface.
- The Proxy pattern, which specifically controls access to objects.
- The Strategy pattern, which changes the original object rather than wrapping it.