Created
March 21, 2018 08:55
-
-
Save chj3737/253178f275ef3b53bcfcb29a0879c2d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
interface TargetInterface { | |
TargetObject operate(); | |
} | |
class LegacyObject { | |
Object method(); | |
} | |
class AdapterForLegacy implements TargetInterface { | |
LegacyObject legacy; | |
public AdapterForLegacy(LegacyObject _legacy) { | |
legacy = _legacy; | |
} | |
@Override | |
Object operate() { | |
Object obj = legacy.method(); | |
TargetObject toObj = toObj(obj); | |
return toObj; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment