Adapter Pattern Components:
- Target Interface: Operation interface - defines the interface the client expects to work with
- Adaptee: CustomMathOperation class - existing class with incompatible interface that needs to be adapted
- Adapter: MathOperation class - wraps the Adaptee and provides the expected interface to the client
- Client: AdapterPatternTest - uses the adapter without knowing about the underlying Adaptee
┌─────────────────────────────┐
│ Client │
└─────────────────────────────┘
│ uses
▼
┌─────────────────────────────┐
│ <<interface>> │
│ Operation │ ← Target Interface
├─────────────────────────────┤
│ + add(int, int): int │
└─────────────────────────────┘
△
│ implements
│
┌────────────────────────────────┐ ┌──────────────────────────────────┐
│ MathOperation │ ────→ │ CustomMathOperation │ ← Adaptee
├────────────────────────────────┤ ├──────────────────────────────────┤
│ - adaptee: CustomMathOperation │ │ + customAdd(String, String): int │
│ + add(int, int): int │ └──────────────────────────────────┘
└────────────────────────────────┘