update:demo4

This commit is contained in:
dichgrem
2025-11-28 16:59:17 +08:00
parent 41e6b71bd7
commit 5832b4fe9d
34 changed files with 307 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package com.study.demo4;
class PaymentFactory {
public static PaymentProcessor getProcessor(String type) {
switch (type.toLowerCase()) {
case "wechat":
return new WechatPayment();
case "alipay":
return new AlipayPayment();
case "card":
return new CreditCardPayment();
default:
throw new IllegalArgumentException("不支持的支付方式");
}
}
}