对于我的应用程序要求,我需要所有操作类在每次执行操作时执行一些操作。我创建了一个新的抽象类来扩展 AbstractInstallAction
类如下:
public abstract class AbstractInvestigatorInstallAction extends AbstractInstallAction {
private static final long serialVersionUID = -7004320241363920697L;
@Override
public boolean install(InstallerContext context) throws UserCanceledException {
ActionReport report = investigate(context);
return onFinish(context, report);
}
public abstract ActionReport investigate(Context context);
public abstract boolean onFinish(Context context, ActionReport report);
}
现在,假设我创建了一个自定义操作类 BlaInvestigation
这扩展了这个 AbstractInvestigatorInstallAction
而不是AbstractInstallAction
。但是当我在 Install4j 项目中添加这两个类时,我没有看到新的操作类 BlaInvestigation
当我从 search action in custom code
查找自定义操作时,我没找到。我应该直接实现 InstallAction
类代替?创建本地 AbstractInstallAction 是否有效?
最佳答案
从 install4j 7.0 开始,自定义代码搜索对话框不检查类层次结构。如果您向所有派生类添加额外的 implements InstallAction
,对话框将找到它们。
关于java - Install4j:将 AbstractInstallAction 类扩展为另一个抽象类并实现它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48282188/