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 2727public interface IOtherInfo {
2828
2929 /**
30- * @Description: 获取用户的User信息
31- * @return HashMap<String,String>
30+ * @Description:获取用户的User信息
31+ * @return: HashMap<String,String>
32+ * @CreatTime: 2018年9月23日
3233 * @Autor: Jason - jasonandy@hotmail.com
3334 */
3435 HashMap <String ,String > getUserInfo ();
3536
3637 /**
3738 * @Description: 获取的是用户的job信息
38- * @return HashMap<String,String>
39+ * @return: HashMap<String,String>
40+ * @CreatTime: 2018年9月23日
3941 * @Autor: Jason - jasonandy@hotmail.com
4042 */
4143 HashMap <String ,String > getUserJobInfo ();
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class ChargeTest {
2929 /**
3030 *
3131 * @Description: Just for test
32- * @param args void
32+ * @param args
3333 * @Autor: Jason - jasonandy@hotmail.com
3434 */
3535 public static void main (String [] args ) {
@@ -38,6 +38,12 @@ public static void main(String[] args) {
3838
3939 ThreeInterface threeInterface = new Three2TwoAdapter (twoInterface );
4040
41+ ThreeInterface threeInterface2 = new HongKongCharge ();
42+
43+ Three3TwoAdapter three3TwoAdapter = new Three3TwoAdapter (threeInterface2 );
44+
45+ three3TwoAdapter .OfferPowerForTwo ();
46+
4147 threeInterface .OfferPowerForThree ();
4248 }
4349
Original file line number Diff line number Diff line change 2525*/
2626public class ChinaCharge implements TwoInterface {
2727
28+ /**
29+ * OfferPowerForTwo 标准的两口插座
30+ */
2831 @ Override
2932 public void OfferPowerForTwo () {
30- System .out .println ("I'm China Charge. 220V." );
33+ System .out .println ("I'm China Charge. 220V. - 中国的标准的220V 50HZ 电源. " );
3134 }
32-
33-
3435
3536}
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 2727public class Three2TwoAdapter implements ThreeInterface {
2828
2929 /**
30- * 2口充电头
30+ * 2口充电头 - 适配器
3131 */
3232 TwoInterface twoInterface ;
3333
34-
34+ /**
35+ * 3口 转两口的插座 - 适配
36+ * @param twoInterface
37+ */
3538 public Three2TwoAdapter (TwoInterface twoInterface ) {
3639 super ();
3740 this .twoInterface = twoInterface ;
3841 }
3942
4043
44+ /**
45+ * 三口的适配器 适用的是俩孔的插座
46+ */
4147 @ Override
4248 public void OfferPowerForThree () {
4349 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 2525public interface ThreeInterface {
2626
2727 /**
28- * @Description: 三个口的插头有 一 个 功能,能够为三个触角的插头提供电源
29- * @Autor: jasonandy@hotmail.com
28+ * @Description:三个口的插头有 一 个 功能,能够为三个触角的插头提供电源
29+ * @CreatTime: 2018年9月23日
30+ * @Autor: Jason - jasonandy@hotmail.com
3031 */
3132 public void OfferPowerForThree ();
3233
Original file line number Diff line number Diff line change 66 * <p> Created on 19941115</p>
77 * <p> Created by Jason</p>
88 * </body>
9+ * s
910 * </html>
1011 */
1112package cn .ucaner .pattern .structure .adapter .charge .inf ;
2526public interface TwoInterface {
2627
2728 /**
28- *
29- * @Description: 两口
30- * @Autor: Jason - jasonandy@hotmail.com
29+ * @Description: 两口的插座
30+ * @CreatTime: 2018年9月23日
31+ * @Autor: Jason - jasonandy@hotmail.com
3132 */
3233 public void OfferPowerForTwo ();
3334
You can’t perform that action at this time.
0 commit comments