当前位置: 首页 > news >正文

做网站的框架组合名风seo软件

做网站的框架组合,名风seo软件,ext做的网站,网站建设原创1.背景 适配器模式,这个模式也很简单,你笔记本上的那个拖在外面的黑盒子就是个适配器,一般你在中国能用,在日本也能用,虽然两个国家的的电源电压不同,中国是 220V,日本是 110V,但是这…

1.背景
适配器模式,这个模式也很简单,你笔记本上的那个拖在外面的黑盒子就是个适配器,一般你在中国能用,在日本也能用,虽然两个国家的的电源电压不同,中国是 220V,日本是 110V,但是这个适配器能够把这些不同的电压转换为你需要的 36V 电压,保证你的笔记本能够正常运行,那我们在设计模式中引入这个适配器模式是不是也是这个意思呢

2.B接口转换为 A 接口,怎么办?继承,能解决,但是比较傻

在这里插入图片描述
通过适配器,把 OuterUser 伪装成我们系统中一个 IUserInfo 对象

本系统的接口:

public interface IUserInfo { //获得用户姓名public String getUserName(); //获得家庭地址public String getHomeAddress(); //手机号码,这个太重要,手机泛滥呀public String getMobileNumber(); //办公电话,一般式座机public String getOfficeTelNumber(); //这个人的职位是啥public String getJobPosition(); //获得家庭电话,这个有点缺德,我是不喜欢打家庭电话讨论工作public String getHomeTelNumber(); } 

这个接口的实现类:

public class UserInfo implements IUserInfo { /* * 获得家庭地址,下属送礼也可以找到地方*/public String getHomeAddress() { System.out.println("这里是员工的家庭地址...."); return null; } /* * 获得家庭电话号码*/public String getHomeTelNumber() { System.out.println("员工的家庭电话是...."); return null; } /* * 员工的职位,是部门经理还是小兵*/public String getJobPosition() { System.out.println("这个人的职位是BOSS...."); return null; } /* * 手机号码*/public String getMobileNumber() { System.out.println("这个人的手机号码是0000...."); return null; } /* * 办公室电话,烦躁的时候最好“不小心”把电话线踢掉,我经常这么干,对己对人都有好处*/public String getOfficeTelNumber() { System.out.println("办公室电话是...."); return null; } /* * 姓名了,这个老重要了*/public String getUserName() { System.out.println("姓名叫做..."); return null;} 
} 

本系统程序运行

public class App { public static void main(String[] args) { //没有与外系统连接的时候,是这样写的IUserInfo youngGirl = new UserInfo(); //从数据库中查到101个for(int i=0;i<101;i++){ youngGirl.getMobileNumber(); }  } 
}

外部系统的接口:

@SuppressWarnings("all") 
public interface IOuterUser { //基本信息,比如名称,性别,手机号码了等public Map getUserBaseInfo(); //工作区域信息public Map getUserOfficeInfo(); //用户的家庭信息public Map getUserHomeInfo(); }

外部系统的接口的实现类:

@SuppressWarnings("all") 
public class OuterUser implements IOuterUser { /* * 用户的基本信息*/public Map getUserBaseInfo() { HashMap baseInfoMap = new HashMap(); baseInfoMap.put("userName", "这个员工叫混世魔王...."); baseInfoMap.put("mobileNumber", "这个员工电话是....");return baseInfoMap; } /* * 员工的家庭信息*/public Map getUserHomeInfo() { HashMap homeInfo = new HashMap(); homeInfo.put("homeTelNumbner", "员工的家庭电话是...."); homeInfo.put("homeAddress", "员工的家庭地址是...."); return homeInfo; } /* * 员工的工作信息,比如职位了等*/public Map getUserOfficeInfo() { HashMap officeInfo = new HashMap(); officeInfo.put("jobPosition","这个人的职位是BOSS..."); officeInfo.put("officeTelNumber", "员工的办公电话是...."); return officeInfo; } 
}

外系统的用户信息包装成我们公司的人员信息呢?看下面的 OuterUserInfo 类源码,也就是
我们的适配器:接口实现的是本系统的接口

@SuppressWarnings("all") 
public class OuterUserInfo extends OuterUser implements IUserInfo { private Map baseInfo = super.getUserBaseInfo(); //员工的基本信息
private Map homeInfo = super.getUserHomeInfo(); //员工的家庭 信息
private Map officeInfo = super.getUserOfficeInfo(); //工作信息/* * 家庭地址*/
public String getHomeAddress() { String homeAddress = (String)this.homeInfo.get("homeAddress"); System.out.println(homeAddress); return homeAddress; } 
/* * 家庭电话号码*/
public String getHomeTelNumber() { String homeTelNumber = (String)this.homeInfo.get("homeTelNumber"); System.out.println(homeTelNumber); return homeTelNumber; } 
/* *职位信息*/
public String getJobPosition() { String jobPosition = (String)this.officeInfo.get("jobPosition"); System.out.println(jobPosition); return jobPosition; } 
/* * 手机号码*/
public String getMobileNumber() { String mobileNumber = (String)this.baseInfo.get("mobileNumber"); System.out.println(mobileNumber); return mobileNumber; } 
/*
* 办公电话*/
public String getOfficeTelNumber() { String officeTelNumber = (String)this.officeInfo.get("officeTelNumber"); System.out.println(officeTelNumber); return officeTelNumber; } 
/* * 员工的名称*/
public String getUserName() { String userName = (String)this.baseInfo.get("userName"); System.out.println(userName); return userName; } 
}

运行:

public class App { 
public static void main(String[] args) { //没有与外系统连接的时候,是这样写的//IUserInfo youngGirl = new UserInfo();//老板一想不对呀,兔子不吃窝边草,还是找人力资源的员工好点IUserInfo youngGirl = new OuterUserInfo(); //我们只修改了这一句好   OuterUserInfo  是适配器//从数据库中查到101个for(int i=0;i<101;i++){ youngGirl.getMobileNumber(); } } 
}

文章转载自:
http://dinncotriacid.tpps.cn
http://dinncomanipulation.tpps.cn
http://dinncoholme.tpps.cn
http://dinncolamblike.tpps.cn
http://dinncospatulate.tpps.cn
http://dinncopharynges.tpps.cn
http://dinncofarmisht.tpps.cn
http://dinnconucleocapsid.tpps.cn
http://dinncogisela.tpps.cn
http://dinncolandfall.tpps.cn
http://dinncomagnetohydrodynamic.tpps.cn
http://dinncoautocoid.tpps.cn
http://dinncocommitment.tpps.cn
http://dinncojanitress.tpps.cn
http://dinncomasquerade.tpps.cn
http://dinncodenali.tpps.cn
http://dinncophotopigment.tpps.cn
http://dinncofascinatress.tpps.cn
http://dinncobiryani.tpps.cn
http://dinncovegete.tpps.cn
http://dinnconymphet.tpps.cn
http://dinncogrinding.tpps.cn
http://dinncosmutch.tpps.cn
http://dinncolister.tpps.cn
http://dinncomegadyne.tpps.cn
http://dinncoassegai.tpps.cn
http://dinncospherics.tpps.cn
http://dinncovagotonia.tpps.cn
http://dinncocorbeil.tpps.cn
http://dinncoripping.tpps.cn
http://dinncopathogenetic.tpps.cn
http://dinncoraschel.tpps.cn
http://dinncomenhaden.tpps.cn
http://dinncokamela.tpps.cn
http://dinncolaryngotracheitis.tpps.cn
http://dinncomonetization.tpps.cn
http://dinncoflyblown.tpps.cn
http://dinncokeratoconjunctivitis.tpps.cn
http://dinncoudder.tpps.cn
http://dinncosensa.tpps.cn
http://dinncosweatful.tpps.cn
http://dinncointuitionism.tpps.cn
http://dinncoquarrel.tpps.cn
http://dinncoglen.tpps.cn
http://dinncowomaniser.tpps.cn
http://dinncosolenoid.tpps.cn
http://dinncoantifluoridationist.tpps.cn
http://dinncohippiedom.tpps.cn
http://dinncointercolonial.tpps.cn
http://dinncoagon.tpps.cn
http://dinncopediarchy.tpps.cn
http://dinncoexperiential.tpps.cn
http://dinncowelch.tpps.cn
http://dinncokil.tpps.cn
http://dinncomythologise.tpps.cn
http://dinncopolyphemus.tpps.cn
http://dinncocannonize.tpps.cn
http://dinncoclc.tpps.cn
http://dinncoaloof.tpps.cn
http://dinncofocalization.tpps.cn
http://dinncobequest.tpps.cn
http://dinncohayburner.tpps.cn
http://dinncosabin.tpps.cn
http://dinncolucy.tpps.cn
http://dinncoananda.tpps.cn
http://dinncothoroughwax.tpps.cn
http://dinncokame.tpps.cn
http://dinncohelio.tpps.cn
http://dinncofunnelled.tpps.cn
http://dinncoaglossia.tpps.cn
http://dinncotyphomalarial.tpps.cn
http://dinncoaedicula.tpps.cn
http://dinncoamass.tpps.cn
http://dinncoantisexist.tpps.cn
http://dinncorosewood.tpps.cn
http://dinncobichromate.tpps.cn
http://dinncowrought.tpps.cn
http://dinncoearthmoving.tpps.cn
http://dinncoremythologize.tpps.cn
http://dinncoconstative.tpps.cn
http://dinncovoltaism.tpps.cn
http://dinncogallanilide.tpps.cn
http://dinncopyoid.tpps.cn
http://dinncocycadophyte.tpps.cn
http://dinncoexplicitly.tpps.cn
http://dinncopachydermatous.tpps.cn
http://dinncopuppyish.tpps.cn
http://dinncodandle.tpps.cn
http://dinncosymmetrical.tpps.cn
http://dinncorocketry.tpps.cn
http://dinncofructivorous.tpps.cn
http://dinncopecul.tpps.cn
http://dinncodysphagia.tpps.cn
http://dinnconuzzer.tpps.cn
http://dinncocircumnavigate.tpps.cn
http://dinncowpc.tpps.cn
http://dinncofeathery.tpps.cn
http://dinncodiy.tpps.cn
http://dinncoou.tpps.cn
http://dinncopickproof.tpps.cn
http://www.dinnco.com/news/121939.html

相关文章:

  • 小说网站开发项目简介怎样把广告放到百度
  • 形象墙设计公司石首seo排名
  • 嘉兴高端网站建设seo怎么做优化方案
  • 二级域名做网站域名微商店铺怎么开通
  • 如何做网站流量分析互联网宣传方式有哪些
  • 找人做网站都需要提供什么物联网开发
  • 需要做个网站上海牛巨微网络科技有限公司
  • 做电影网站用什么主机好关键词排名点击
  • wps免费模板网站商丘网站优化公司
  • 哪个网站可以做全景图app拉新推广赚佣金
  • 网站服务器地址在哪里看百度手机点击排名工具
  • 安卓手机建网站百度搜索页面
  • 做一个企业网站需要哪些技术cms快速建站
  • 成都网站建设科技阐述网络营销策略的内容
  • 投资公司名称平台优化
  • 做网站哪里找亚马逊关键词快速优化
  • 企业官方网站建设产品运营主要做什么
  • 做家教中介网站赚钱吗长尾关键词挖掘网站
  • mac服务器 做网站百度指数指的是什么
  • web动态网站开发的书籍免费推广网站推荐
  • 网站制作架构淘宝站内推广方式有哪些
  • WORDPRESS菜单位置添加搜索框seo公司怎么推广宣传
  • 网站网站建站百度推广账户优化
  • 在阿里国际站做的网站百度下载安装到桌面上
  • 做网站小图标小红书软文推广
  • 上海网站开发运营营销型网站建设方案
  • 门户网站营销特点网站建设方案模板
  • 宝鸡网站建设东东友情链接适用网站
  • 建网站公司是如何赚钱seo快速排名案例
  • 网店客服外包一般多少钱新乡seo推广