Adapter design pattern
8 March 2008A Adapter design pattern is Structural design pattern. It is also called as wrapper pattern or just a wrapper. Some classes could not work together because of incompatible interfaces. An adapter allows classes to work together by wrapping its own interface around that of an already existing class. The adapter also handles the logic necessary to transform data into an appropriate form.
The adapter design pattern is useful in circumstances where an already existing class provides some or all of the services you require but does not use the interface you require. The adapter design pattern adapts one interface for a class into one that a client expects.
The adapter patterns are of two types
Object Adapter pattern: In this type of adapter pattern, the adapter contains an OBJECT of the class it wraps. In such a situation, the adapter makes calls to the instance of the wrapped object.
Class Adapter pattern: It requires multiple multiple inheritance. As Java that does not support multiple inheritance, the Class Adapter pattern cannot be used in Java.
Related Posts:
- The Facade Design Pattern (I)
- Adapter design pattern (II)
- The Strategy Design Pattern in Java(I)
- Singleton - Creational Design Pattern (I)
- The Observer Design Pattern(I)
- Design Patterns - Basics (I)
- The Strategy Design Pattern in Java(II)
- The Facade Design Pattern (II)
- Introduction to Model View Controller Architecture (II)
- Singleton - Creational Design Pattern (II)
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Adapter design pattern