File tree Expand file tree Collapse file tree 8 files changed +102
-14
lines changed
src/cn/ucaner/pattern/structure/adapter Expand file tree Collapse file tree 8 files changed +102
-14
lines changed Original file line number Diff line number Diff line change 27
27
public interface IOtherInfo {
28
28
29
29
/**
30
- * @Description: 获取用户的User信息
31
- * @return HashMap<String,String>
30
+ * @Description:获取用户的User信息
31
+ * @return: HashMap<String,String>
32
+ * @CreatTime: 2018年9月23日
32
33
* @Autor: Jason - jasonandy@hotmail.com
33
34
*/
34
35
HashMap <String ,String > getUserInfo ();
35
36
36
37
/**
37
38
* @Description: 获取的是用户的job信息
38
- * @return HashMap<String,String>
39
+ * @return: HashMap<String,String>
40
+ * @CreatTime: 2018年9月23日
39
41
* @Autor: Jason - jasonandy@hotmail.com
40
42
*/
41
43
HashMap <String ,String > getUserJobInfo ();
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class ChargeTest {
29
29
/**
30
30
*
31
31
* @Description: Just for test
32
- * @param args void
32
+ * @param args
33
33
* @Autor: Jason - jasonandy@hotmail.com
34
34
*/
35
35
public static void main (String [] args ) {
@@ -38,6 +38,12 @@ public static void main(String[] args) {
38
38
39
39
ThreeInterface threeInterface = new Three2TwoAdapter (twoInterface );
40
40
41
+ ThreeInterface threeInterface2 = new HongKongCharge ();
42
+
43
+ Three3TwoAdapter three3TwoAdapter = new Three3TwoAdapter (threeInterface2 );
44
+
45
+ three3TwoAdapter .OfferPowerForTwo ();
46
+
41
47
threeInterface .OfferPowerForThree ();
42
48
}
43
49
Original file line number Diff line number Diff line change 25
25
*/
26
26
public class ChinaCharge implements TwoInterface {
27
27
28
+ /**
29
+ * OfferPowerForTwo 标准的两口插座
30
+ */
28
31
@ Override
29
32
public void OfferPowerForTwo () {
30
- System .out .println ("I'm China Charge. 220V." );
33
+ System .out .println ("I'm China Charge. 220V. - 中国的标准的220V 50HZ 电源. " );
31
34
}
32
-
33
-
34
35
35
36
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * <html>
3
+ * <body>
4
+ * <P> Copyright 1994 JsonInternational</p>
5
+ * <p> All rights reserved.</p>
6
+ * <p> Created on 19941115</p>
7
+ * <p> Created by Jason</p>
8
+ * </body>
9
+ * </html>
10
+ */
11
+ package cn .ucaner .pattern .structure .adapter .charge ;
12
+
13
+ import cn .ucaner .pattern .structure .adapter .charge .inf .ThreeInterface ;
14
+
15
+ /**
16
+ * @Package:cn.ucaner.pattern.structure.adapter.charge
17
+ * @ClassName:HongKongCharge
18
+ * @Description: <p> </p>
19
+ * @Author: - Jason
20
+ * @CreatTime:2018年9月23日 - 上午11:00:08
21
+ * @Modify By:
22
+ * @ModifyTime: 2018年9月23日
23
+ * @Modify marker:
24
+ * @version V1.0
25
+ */
26
+ public class HongKongCharge implements ThreeInterface {
27
+
28
+ /**
29
+ * 大家好这里是标准的3口插头
30
+ */
31
+ @ Override
32
+ public void OfferPowerForThree () {
33
+ System .out .println ("I'm Three Charge - HK Standard" );
34
+ }
35
+
36
+ }
Original file line number Diff line number Diff line change 27
27
public class Three2TwoAdapter implements ThreeInterface {
28
28
29
29
/**
30
- * 2口充电头
30
+ * 2口充电头 - 适配器
31
31
*/
32
32
TwoInterface twoInterface ;
33
33
34
-
34
+ /**
35
+ * 3口 转两口的插座 - 适配
36
+ * @param twoInterface
37
+ */
35
38
public Three2TwoAdapter (TwoInterface twoInterface ) {
36
39
super ();
37
40
this .twoInterface = twoInterface ;
38
41
}
39
42
40
43
44
+ /**
45
+ * 三口的适配器 适用的是俩孔的插座
46
+ */
41
47
@ Override
42
48
public void OfferPowerForThree () {
43
49
twoInterface .OfferPowerForTwo ();
Original file line number Diff line number Diff line change
1
+ /**
2
+ * <html>
3
+ * <body>
4
+ * <P> Copyright 1994-2018 JasonInternational</p>
5
+ * <p> All rights reserved.</p>
6
+ * <p> Created on ${date} </p>
7
+ * <p> Created by Jason - jasonandy@hotmail.com </p>
8
+ * </body>
9
+ * </html>
10
+ */
11
+ package cn .ucaner .pattern .structure .adapter .charge ;
12
+
13
+ import cn .ucaner .pattern .structure .adapter .charge .inf .ThreeInterface ;
14
+ import cn .ucaner .pattern .structure .adapter .charge .inf .TwoInterface ;
15
+
16
+ public class Three3TwoAdapter implements TwoInterface {
17
+
18
+ ThreeInterface threeInterface ;
19
+
20
+ /**
21
+ * 2口 转3口的插座 - 适配
22
+ * @param twoInterface
23
+ */
24
+ public Three3TwoAdapter (ThreeInterface threeInterface ) {
25
+ super ();
26
+ this .threeInterface = threeInterface ;
27
+ }
28
+
29
+
30
+ @ Override
31
+ public void OfferPowerForTwo () {
32
+ threeInterface .OfferPowerForThree ();
33
+ }
34
+
35
+ }
Original file line number Diff line number Diff line change 25
25
public interface ThreeInterface {
26
26
27
27
/**
28
- * @Description: 三个口的插头有 一 个 功能,能够为三个触角的插头提供电源
29
- * @Autor: jasonandy@hotmail.com
28
+ * @Description:三个口的插头有 一 个 功能,能够为三个触角的插头提供电源
29
+ * @CreatTime: 2018年9月23日
30
+ * @Autor: Jason - jasonandy@hotmail.com
30
31
*/
31
32
public void OfferPowerForThree ();
32
33
Original file line number Diff line number Diff line change 6
6
* <p> Created on 19941115</p>
7
7
* <p> Created by Jason</p>
8
8
* </body>
9
+ * s
9
10
* </html>
10
11
*/
11
12
package cn .ucaner .pattern .structure .adapter .charge .inf ;
25
26
public interface TwoInterface {
26
27
27
28
/**
28
- *
29
- * @Description: 两口
30
- * @Autor: Jason - jasonandy@hotmail.com
29
+ * @Description: 两口的插座
30
+ * @CreatTime: 2018年9月23日
31
+ * @Autor: Jason - jasonandy@hotmail.com
31
32
*/
32
33
public void OfferPowerForTwo ();
33
34
You can’t perform that action at this time.
0 commit comments