Changes

Jump to: navigation, search

Adapter

9 bytes added, 16:11, 27 March 2007
Object Adapter Pattern
There are two specific types of adapter patterns - ''object adapter pattern'' and ''class adapter pattern''. The latter uses multiple inheritance whereas the former uses an instance of the reuseable class it wants to adapt. Between the two, object adapter pattern is the favored one due to the fact that popular languages such as Java do not support multiple inheritance.
== Object Adapter Pattern ==
This adapter pattern uses an instance of the class it wraps. By using an instance, methods belonging to the wrapped object can be invoked.
[[Image:objectadapter_diag_rueen2.GIF]]
== Class Adapter Pattern ==
This adapter pattern uses multiple inheritance as a means to wrap the reusable class and use its functionality.
FreeMind's [http://www.google.com/codesearch?hl=en&q=show:SSjMlfyYK2U:RCv_23t_s7k:tpy_iiX4ncI&sa=N&ct=rd&cs_p=http://gentoo.osuosl.org/distfiles/freemind-src-0_7_1.tar.gz&cs_f=freemind/freemind/modes/ArrowLinkAdapter.java File Repository]
 Explanation: In this example, an ArrowLinkAdapter is created to be used to adapt different arrow shaped links in FreeMind's MindMap area. ArrowLinkAdapter .java is the '''Adapter''' and LinkAdapter .java is the '''Adaptee'''. Even though LinkAdapter is an adapter itself, it is infact the adaptee in this case.
1
edit

Navigation menu