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

@@ -15,17 +15,20 @@ javac adapter/*.java
java adapter.Main
```
Requires Java 11+.
Requires Java 25.
## Files
| File | Role |
| Post Section | File(s) |
|---|---|
| `PaymentGateway.java` | Target interface (what your app expects) |
| `StripeClient.java` | Adaptee (third-party SDK you can't modify) |
| `StripePaymentAdapter.java` | Adapter (bridges the two) |
| `OrderService.java` | Client (only uses PaymentGateway) |
| `Main.java` | Demo entry point |
| 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.
## See Also