Adapter
Intent
Convert the interface of a class into another interface that clients expect.Adatper let classes work together that couldn't otherwise because of incompatible interfaces.
Applicability
Use Adapter pattern when
1)you want to use an existing class,and its interface does not match what you need.
Structure
Object Adapter
Class Adapter
Participant
1)Target
defines the domain-specific interface that Client expects.
2)Client
collaborates with objects conforming to the Target interface.
3)Adaptee
defines an existing interface that needs adapting.
4)Adapter
adapts the interface of adaptee to the Target interface
Consequences
Class adapter and Object adapter has different trade-offs.
for class adapter:
1)lets Adapter override some of Adaptee's behavior, since Adapter is a subclass of
Adaptee
2)adapts Adaptee to Target by committing to a concrete Adapter class. As a
consequence, a class adapter won't work when we want to adapt a class and all its
subclasses
3) introduces only one object,and no additional pointer indirection is needed to get to adaptee..
for Object adapter:
1)Let a single adapter work with many adaptees-that is,the adaptee itself and all of its subclasses(if any).The Adapter can also add functionality to all adaptees at once.
2) Makes it harder to override Adaptee behavior.It will require subclassing Adaptee and making Adapter refer to the subclass rather than the Adaptee itself.
Two-way adapter.
Usage
Data transforming.
- 大小: 19.5 KB
- 大小: 22.9 KB
分享到:
相关推荐
赠送jar包:sentinel-spring-webmvc-adapter-1.8.0.jar; 赠送原API文档:sentinel-spring-webmvc-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webmvc-adapter-1.8.0-sources.jar; 赠送Maven依赖信息...
usb 2.0 to fast ethernet adapter win7 win8 xp驱动, 我的笔记本电脑由于使用时间较长,有线接口有点接触不良,所以上网买了个USB2.0 to Fast Ethernet Adapter 的适配器(将USB口转换为网口,可以插网线),首先...
赠送jar包:sentinel-api-gateway-adapter-common-1.8.0.jar; 赠送原API文档:sentinel-api-gateway-adapter-common-1.8.0-javadoc.jar; 赠送源代码:sentinel-api-gateway-adapter-common-1.8.0-sources.jar; ...
赠送jar包:sentinel-spring-cloud-gateway-adapter-1.8.0.jar; 赠送原API文档:sentinel-spring-cloud-gateway-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-cloud-gateway-adapter-1.8.0-sources....
赠送jar包:sentinel-reactor-adapter-1.8.0.jar; 赠送原API文档:sentinel-reactor-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-reactor-adapter-1.8.0-sources.jar; 赠送Maven依赖信息文件:sentinel-...
赠送jar包:sentinel-api-gateway-adapter-common-1.8.0.jar; 赠送原API文档:sentinel-api-gateway-adapter-common-1.8.0-javadoc.jar; 赠送源代码:sentinel-api-gateway-adapter-common-1.8.0-sources.jar; ...
Wireless N Adapter驱动,不会用的联我的QQ,这个是手动安装的,所以很小
XAdapter Support for the pull-down refresh loading and the addition of multiple header and footer RecyclerViewAdapter Blog:https://7449.github.io/Android_XAdapter/ Screenshots ...
生活中有很多Adapter的例子。比方说,你买了一款舒适、手感极佳的键盘,它是P/S接口的,然而你的新式电脑已经淘汰了P/S接口,只提供USB接口。此时,为了能够使用这款键盘,就需要一个转接头,它的一头是P/S接口的,...
2.RecyclerView合并两个Adapter为一个adapter 2.RecyclerView合并两个Adapter为一个adapter 2.RecyclerView合并两个Adapter为一个adapter
赠送jar包:sentinel-spring-webmvc-adapter-1.8.0.jar; 赠送原API文档:sentinel-spring-webmvc-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webmvc-adapter-1.8.0-sources.jar; 赠送Maven依赖信息...
PC Adapter USB Drive,PC Adapter USB Drive,PC Adapter USB Drive
赠送jar包:sentinel-spring-webflux-adapter-1.8.0.jar; 赠送原API文档:sentinel-spring-webflux-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webflux-adapter-1.8.0-sources.jar; 赠送Maven依赖...
使用第一种方式HTTP Receiver Adapter的配置很简单,只要将接收方的URL地址及登录用户填好既可,(如果需要用户验证,根据SAP系统或非SAP系统选择验证类型,如果不需要用户验证,验证类型选择匿名登录) 对于想要...
赠送jar包:sentinel-spring-webflux-adapter-1.8.0.jar; 赠送原API文档:sentinel-spring-webflux-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-spring-webflux-adapter-1.8.0-sources.jar; 赠送Maven依赖...
docker load -i prometheus-adapter-v0.9.1.tar.gz ; docker images |grep k8s.gcr.io/prometheus-adapter/prometheus-adapter
为便于学习自定义的Adapter,本案例的界面未进行美化,功能已经实现,对于其中的getView(int position,View view ,ViewGroup vg)做了数据的填充操作。本案例功能及其简单,只涉及ListView中自定义适配器,没有对...
Bluetooth USB Adapter ES-388. 蓝牙适配器 驱动
用于HP网络打印机的适配器 hp usb network print adapter 驱动程序软件
赠送jar包:sentinel-reactor-adapter-1.8.0.jar; 赠送原API文档:sentinel-reactor-adapter-1.8.0-javadoc.jar; 赠送源代码:sentinel-reactor-adapter-1.8.0-sources.jar; 赠送Maven依赖信息文件:sentinel-...