File tree 1 file changed +35
-0
lines changed
src/behavioral/chain-of-responsibility/java/io/github/hooj0/chainofresponsibility/pay/support
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .github .hooj0 .chainofresponsibility .pay .support ;
2
+
3
+ /**
4
+ * account payment order responsibility chain
5
+ * 账户支付顺序职责链条
6
+ * @author hoojo
7
+ * @createDate 2018年11月18日 上午10:07:39
8
+ * @file PayChain.java
9
+ * @package io.github.hooj0.chainofresponsibility.pay.support
10
+ * @project design-patterns
11
+ * @blog http://hoojo.cnblogs.com
12
+ * @email hoojo_@126.com
13
+ * @version 1.0
14
+ */
15
+ public class PayChain {
16
+
17
+ private Account chain ;
18
+
19
+ public PayChain () {
20
+ chain = chainBuider ();
21
+ }
22
+
23
+ // 构建一个支付账户的链条
24
+ private Account chainBuider () {
25
+ Account account = new BankAccount (300 );
26
+ account = new BitcoinAccount (account , 400 );
27
+ account = new AlipayAccount (account , 200 );
28
+
29
+ return account ;
30
+ }
31
+
32
+ public void pay (int amount ) {
33
+ chain .playHandled (amount );
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments