Fast implement wrapping (delegate methods) in Eclipse?

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

Is there some template or something to implement iterface methods with accessing to wrapped member?

For example, suppose I have

public class MyClass implements List {      private final List core;  ... } 

and now I want to implement List by passing calls to wrapped like

@Override public int size() {     return core.size(); } 

and so on.

回答1:

There is. Use Source menu->Generate Delegate Methods...



回答2:

Tested in Luna.

Use shortcut Alt-Shift-S, M 2 times. Press Enter



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!