Adapterパターンは、互換性のないインターフェースを持つオブジェクトが一緒に動作できるようにします。一方のオブジェクトを、もう一方が期待するインターフェースでラップすることで、2つのインターフェース間の変換役として機能し、既存のコードを変更することなく統合を実現します。
Adapterパターンが行うこと
ADAPTER → convert one interface into another that a client expects (a "translator"):
→ wrap an object whose interface is INCOMPATIBLE, exposing the interface the client needs
→ the adapter translates calls/data between the two interfaces
→ makes incompatible things work together WITHOUT changing either's code
例
{ () { } }
{
() { . = thirdParty; }
() { ..(msg); }
}
logger = ( ());
logger.();
