Design Patterns --Adapter

xiaoxiao2021-04-02  256

Class Adapter

Target is the original interface, Adaptera is the class we implement. The key to this figure is that Adaptera implements Target and inherits Adaptee.

2. Object Adapter

Target is also possible to be an abstract class. The key to this figure is that AdapterB implements or inherits Target, and Adaptee is used in AdapterB in AdapterB in a reference or aggregation.

In addition, only Object Adapter can provide time with multiple Object (Adaptee).

3. JTable is a good example of Adapter mode. When using JTABLE, you usually need to inherit AbstractTableModel and add multiple model elements.

转载请注明原文地址:https://www.9cbs.com/read-131375.html

New Post(0)