Origin: |
GoF 95 |
Reason: |
A client needs the service of an object, Obj,
through an interface, IF, but Obj
does not implement IF.
|
Synopsis: |
Define a class, the Adapter, that implements
interface IF and provides the service via Obj.
|
Example: |
A method copies arrays filtering out some elements.
The criterion to filter out an element is defined by an interface,
CopyFilterIF.
Array elements that have the information for the filtering
criterion may not implement CopyFilterIF.
|
Solution: |
Client |
Class that needs a service through interface TargetIF. |
TargetIF |
Interface expected by Client to obtain a service. |
Adapter |
Class that implements TargetIF and provides
the service using Adaptee.
|
Adaptee |
Class that does not implement TargetIF and provides
the service.
|
|
See also: |
Proxy
Facade
|