Sync Adapter to Java 25: add StripePaymentClassAdapter, README mapping

This commit is contained in:
2026-06-24 14:19:36 +05:30
parent 4b6a02f396
commit 8471913dbd
8 changed files with 60 additions and 56 deletions

View File

@@ -178,6 +178,25 @@ javac 01-creational/singleton/*.java -d out/singleton
java -cp out/singleton singleton.Main
```
### Adapter (`02-structural/adapter/`)
| Post Section | File(s) |
|---|---|
| Step 1 — Define the Target Interface | `PaymentGateway.java` |
| Step 2 — The Adaptee (What You're Wrapping) | `StripeClient.java` |
| Step 3 — The Object Adapter | `StripePaymentAdapter.java` |
| Step 4 — The Client (Knows Nothing About Stripe) | `OrderService.java` |
| Putting It Together: The Main Demo | `Main.java` |
| Object Adapter vs Class Adapter | `StripePaymentClassAdapter.java` |
Note: the `InputStreamReader` JDK-adapter snippet is illustrative only — it is not part of this repository's runnable example.
Run it:
```bash
javac 02-structural/adapter/*.java -d out/adapter
java -cp out/adapter adapter.Main
```
## Reference
- *Design Patterns: Elements of Reusable Object-Oriented Software* — Gamma, Helm, Johnson, Vlissides