是否可以使用 lombok 从基础 class 实例构造派生 class 实例?

Is it possible to construct a derived class instance from a base class instance using lombok?

使用 lombok,我有兴趣通过其构造函数将所有字段从基 class 实例复制到派生 class,这与 C++ 复制构造函数的作用非常相似。目前不太关心副本是深还是浅。 我有一个基数 class 如下所示,

class Parent {
  .... fields
}

并且我有兴趣自动生成派生的 class 构造函数,该构造函数采用基础 class 实例并将所有字段复制(浅或深)到派生字段。例如

class Child extends Parent {
   ... derived fields
   Child(Parent p) { // can be implemented as super(p); 
   }
}

我可以根据需要灵活地注释 ParentChild class,但是不想手工制作构造函数,它逐一复制每个字段。 用法示例

Parent parent = Parent.of(....);
Child child = new Child(parent);

似乎还没有复制构造函数的功能(github issue)

而且它也不可能生成调用 super 的构造函数(规定 here and github issue),因为:

getting to the parent class required resolution, it is simply not possible.

所以基于此,我认为目前无法做到这一点