code-templates

Fast implement wrapping (delegate methods) in Eclipse?

橙三吉。 提交于 2019-11-27 06:35:23
问题 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<Something> { private final List<Something> core; ... } and now I want to implement List<Something> 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: I'll say a bit more about how the "Generate Delegate Methods"