一 adapter
uml图
二 类适配器
public class Adapter extends Adaptee implements Target {
@Override
public void handleReq() {
super.request();
}
}
三 对象适配器
public class Adapter2 implements Target {
private Adaptee adaptee;
@Override
public void handleReq() {
adaptee.request();
}
public Adapter2(Adaptee adaptee) {
super();
this.adaptee = adaptee;
}
}