Eclipse中的快速实现包装(委托方法)? [英] Fast implement wrapping (delegate methods) in Eclipse?

查看:363
本文介绍了Eclipse中的快速实现包装(委托方法)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,假设我有

  public class MyClass implements List< Something> {

private final列表< Something>核心;

...
}

现在我想通过传递电话来实现列表< Something>

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

等等。

解决方案

有。使用源菜单 - >生成代理方法...


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<Sometheing> 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.

解决方案

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

这篇关于Eclipse中的快速实现包装(委托方法)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆