Skip to content

Instantly share code, notes, and snippets.

@chj3737
Last active March 21, 2018 08:31
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/85927cbafcb558d08e5d9e912b65a1ad to your computer and use it in GitHub Desktop.
Save chj3737/85927cbafcb558d08e5d9e912b65a1ad to your computer and use it in GitHub Desktop.
// 应该可以为接口或是抽象类
interface Component {
Object operate();
}
class ComponentImpl {
Object operate() { }
}
// 实现接口或是抽象类
class ComponentDecarator implement Component {
Component component;
ComponentDecarator(Component _component) {
component = _component
}
@Override
Object operate() {
Object obj = component.operate();
this.doSomething();
return obj;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment