Created
April 14, 2014 16:28
-
-
Save crimx/10663131 to your computer and use it in GitHub Desktop.
Adapter Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.crimx.adapter; | |
public class Adapter implements Plug2{ | |
private Plug1 plug1; | |
public Adapter(Plug1 p1) { | |
Plug1 = p1; | |
} | |
public void slot1() { | |
Plug1.slot1(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.crimx.adapter; | |
public interface Plug1 { | |
public void slot1(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.crimx.adapter; | |
public interface Plug2 { | |
public void slot2(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment