Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
The classes and objects participating in this pattern are:
- defines the domain-specific interface that Client uses.
- adapts the interface Adaptee to the Target interface.
- defines an existing interface that needs adapting.
- collaborates with objects conforming to the Target interface.