gpt4 book ai didi

java - 在 Eclipse 中快速实现包装(委托(delegate)方法)?

转载 作者:IT老高 更新时间:2023-10-28 20:51:46 27 4
gpt4 key购买 nike

是否有一些模板或其他东西来实现访问被包装成员的 iterface 方法?

例如,假设我有

public class MyClass implements List<Something> {

private final List<Something> core;

...
}

现在我想实现 List<Something>通过将调用传递给 Wrapped like

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

等等。

最佳答案

有。使用 Source 菜单->Generate Delegate Methods...

关于java - 在 Eclipse 中快速实现包装(委托(delegate)方法)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15397108/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com