We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01f45e5 commit 41c6e7bCopy full SHA for 41c6e7b
adapter/README.md
@@ -18,5 +18,34 @@
18
19
## 模式分析
20
21
-
+> 假定现在有一个小汽车司机,他只会驾驶小型汽车,并不会驾驶公共汽车。
22
+>
23
+> 现在分别定义小汽车 ( Car ) 和公共汽车 ( Bus ) 两种接口
24
+
25
+```
26
+public interface Car {
27
+ void drive();
28
+}
29
30
+public class Bus {
31
+ private static final Logger LOGGER = LoggerFactory.getLogger(Bus.class);
32
+ public void run() {
33
+ LOGGER.info("公共汽车在行驶");
34
+ }
35
36
37
+> 这个司机需要获得一辆小汽车才能进行驾驶活动
38
39
40
+public class Driver implements Car {
41
+ private Car car;
42
+ @Override
43
+ public void drive() {
44
+ car.drive();
45
46
+ public Driver(Car car) {
47
+ this.car = car;
48
49
50
51
## 适用场景
0 commit comments