Sync Adapter to Java 25: add StripePaymentClassAdapter, README mapping
This commit is contained in:
19
README.md
19
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user