Spring 5 Design Patterns
上QQ阅读APP看书,第一时间看更新

Common requirements for the adapter pattern

The following are the common requirements for this design pattern to addresses the design problems:

  • If you are to use this pattern in your application, there is a need to use an existing class with an incompatible interface.
  • Another use of this pattern in your application is when you want to create a reusable class that collaborates with classes that have incompatible interfaces.
  • There are several existing subclasses to be used, but it's impractical to adapt their interface by sub classing each one. An object adapter can adapt the interface of its parent class.

Let's see how Spring implements the adapter design pattern internally.