IntelliJ IDEA shortcuts/workflow for populate fields from one object to another

There area lot of classes in my codebase that have an object passed into its constructor to populate its fields from that object's fields like the following:

public class PersonDataHolder {
    private String name;
    private int age;

    public PersonDataHolder(Person person) {
        this.name = person.getName();
        this.age = person.getAge();
    }
}


Instead of creating this by hand each time, is there an IDEA shortcut/workflow that makes writing these classes more efficiently?

1 comment

Hello,

There is no such feature at the moment. However, you can try to implement that as a simple plugin using, say, intellij-eval.

Denis

0

Please sign in to leave a comment.