我目前有多个类,即FacadeA... FacadeZ,其扩展FacadeBase. FacadeBase应该有(某种通用方法?),即checkFacade,它会抛出一个异常FacadeAException......FacadeZException它扩展了FacadeException.
目前就我所知。我坚持使用通用部分(或任何可以解决我的问题的方法)。
是的,我知道我不能像我的例子中写的那样实例化泛型。
public abstract class FacadeBase {
public void checkFacade(final String facadeId) throws Facade<A...Z>Exception {
if (!isFacadeAvailable(facadeId)) {
throw new Facade<A...Z>Exception(facadeId);
}
}
...
}
public class FacadeA extends FacadeBase {
public void doSomethingWithFacadeA(final String facadeId) throws FacadeAException {
checkFacade(facadeId));
...
}
}
public class FacadeAException extends FacadeException {
private FacadeAException(final String message) {
super(message);
}
}
public abstract class FacadeException extends Exception {
private FacadeException(final String message) {
super(message);
}
}
翻阅古今
慕神8447489
达令说
相关分类