代码之家  ›  专栏  ›  技术社区  ›  ShaDooW

Install4j:将AbstractInstallAction类扩展到另一个抽象类并实现它

  •  1
  • ShaDooW  · 技术社区  · 7 年前

    对于我的应用程序需求,我需要所有动作类在每次执行动作时都执行一些操作。我创建了一个新的抽象类,它扩展了 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 而不是 抽象安装操作 . 但是当我在Install4j项目中添加这两个类时,我没有看到新的action类 BLA调查 当我从 search action in custom code ,我找不到它。我是否应该直接实施 InstallAction 改为上课?创建本地AbstractInstallAction有用吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Ingo Kegel    7 年前

    从install4j 7.0开始,“自定义代码搜索”对话框不会检查类层次结构。如果您添加其他 implements InstallAction 对于所有派生类,对话框将找到它们。