我觉得是Composoite模式,不是理解是否正确?
又觉得像Factory?
public interface Initable {
public void init();
}
public class BaseInitable implements Initable {
public void init() {
//init code
}
}
public interface Service extends Initable {
public Service getService(String name);
}
public class BaseService extends BaseInitable implements Service {
public Service getService(String name) {
//return service instance
}
}