Intellij IDEA中如何自动改变构造函数中的参数?

How to automatically change the parameters in the constructor function in Intellij IDEA?

假设我在 Dimensions class 中再添加一个字段 private String model。然后我还必须将参数 String model 添加到我的构造函数中,然后设置 this.model=model。每当我向 class 添加新字段时,有什么方法可以让 Intellij 自动为我执行此操作?

public class Dimensions {

    private int length;
    private int width;
    private int height;

    public Dimensions(int length, int width, int height) {
        this.length = length;
        this.width = width;
        this.height = height;
    }
}

将插入符号放在成员上,然后按 ALT+ENTER。这将打开一个上下文菜单,从中选择 "Add constructor parameter" 并按 ENTER: