File tree Expand file tree Collapse file tree
pattern/src/com/premaseem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ public static void main (String[] args) {
2323
2424 // Ear plug is not able to take google phone sound signal
2525 Integer soundSignals = googlePhone .getSoundOutput ();
26- earPlug .takeSoundInput (soundSignals );
26+
27+ // Created adapter to convert signals expected by client
28+ EarPlugAdapter earPlugAdapter = new EarPlugAdapter ();
29+ earPlug .takeSoundInput (earPlugAdapter .convertSoundSignal (soundSignals ));
2730
2831 }
2932}
Original file line number Diff line number Diff line change 1+ package com .premaseem ;
2+
3+ /*
4+ @author: Aseem Jain
5+ @title: Design Patterns with Java 9
6+ @link: https://premaseem.wordpress.com/category/computers/design-patterns/
7+ */
8+ public class EarPlugAdapter {
9+
10+ public String convertSoundSignal (Integer soundSignal ){
11+ return soundSignal .toString ();
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments