Skip to content

Commit 01f45e5

Browse files
committed
添加 Adapter README
1 parent 270a5ce commit 01f45e5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929

3030
### 结构型模式
3131

32-
[Adapter (适配器)]()
32+
[Adapter (适配器)](https://github.com/JamesZBL/java_design_patterns/tree/master/adapter)

adapter/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 适配器模式 ( Adapter )
2+
3+
## 别名
4+
5+
> Wrapper (包装器)
6+
7+
## 用途
8+
9+
> 将一个类的接口转换成客户希望的另外一个接口。 Adapter模式使得原本由于接口不兼容
10+
而不能一起工作的那些类可以一起工作。
11+
12+
## 实例
13+
14+
> 假设一下你的存储卡里有一些照片,你需要把它们转移到你的电脑上。为了转移它们,你
15+
需要一些与你的电脑接口兼容的适配器,这样你就可以将存储卡连接到你的电脑上。这里,
16+
读卡器就起到了适配器的作用。更经典的例子就是人尽皆知的电源适配器了,一个三脚的
17+
插头不能连接到两个孔的插座上,它需要一个电源适配器,使它与两个分叉的插座兼容。
18+
19+
## 模式分析
20+
21+
22+
## 适用场景

0 commit comments

Comments
 (0)