એડપ્ટર પેટર્ન અસંગત ઈન્ટરફેસ ધરાવતી વસ્તુઓને એક બીજા સાથે કામ કરવાની સુવિધા આપે છે, એક વસ્તુને બીજી દ્વારા અપેક્ષિત ઈન્ટરફેસ સાથે લપેટીને. તે બે ઈન્ટરફેસ વચ્ચે અનુવાદક તરીકે કાર્ય કરે છે, જે હાલના કોડમાં સુધાર કર્યા વિના એકીકરણ સક્ષમ કરે છે.
એડપ્ટર પેટર્ન શું કરે છે
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.();
