Skip to content

Instantly share code, notes, and snippets.

@chj3737
Created March 21, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chj3737/253178f275ef3b53bcfcb29a0879c2d6 to your computer and use it in GitHub Desktop.
Save chj3737/253178f275ef3b53bcfcb29a0879c2d6 to your computer and use it in GitHub Desktop.
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