【发布时间】:2015-12-17 07:38:07
【问题描述】:
我有以下抽象类。
abstract class AbstractSome implements Interface1, Interface2 {
// all methods defined in Interface1 is implemented
}
现在我想使用实现Interface2 的委托来扩展这个类。
class ????Some extends AbstractSome {
public ????Some(final Interface2 delegate) {
this.delegate = delegate;
}
@Override // defined in Interface2
public void doSomething() {
delegate.doSomething();
}
private final Interface2 delegate;
}
这个封闭类有什么好的naming-convention吗?
Delegating... 或 Default... 好吗?
【问题讨论】:
-
这似乎是基于意见的问题,但我希望看到一些好的回应。
-
没有这样的约定。对于类抽象类 InMemoryFile 实现可读,可写我会调用这样的类 DelegateWriteInMemoryFile
标签: java delegates naming-conventions