Design Patterns - Adapter Pattern
Key words: Not change under laying behavior
UML
Adapter Pattern
Pseudo Code
interface ITarget {
void request();
}
class Adapter implements ITarget {
Adaptee adaptee;
public Adapter(Adaptee a) {
this.adaptee = a;
}
public void request() {
this.adaptee.specificRequest();
}
}
class Adaptee {
public specificRequest() {
// Do something
}
}
// From client
ITarget target = new Adapter(new Adaptee());
target.request();