1. Overview
Transforms the interface of one class into another interface that the customer wants. The adapter mode makes it possible to work together those classes that would otherwise not work together because of incompatible interfaces.
2. Issues to solve
That is, the adapter mode makes it possible for those classes that cannot work together because the interface is incompatible.
Here are two very vivid examples.
3. Roles in the pattern
3.1 Destination Interface (target): the interface that the customer expects. The target can be a specific or abstract class, or it can be an interface.
3.2 Classes that need to be adapted (Adaptee): A class or an adapter class that needs to be adapted.
3.3 Adapter (Adapter): Converts the original interface into a target interface by wrapping an object that needs to be adapted.
4. How to Implement
(1) Class of Adapter mode (implemented with inheritance)
(2) object adapter (implemented by object combination)
An initial discussion of the Java design pattern in adapter mode