我有两个类Child
延伸Parent
。我需要在类上添加@Builder注释,以便我不需要创建自己的构建器。Lombok @builder上扩展了另一个类的类
package jerry;// Internal compiler error: java.lang.NullPointerException
import lombok.AllArgsConstructor;
import lombok.Builder;
@AllArgsConstructor([email protected]__(@Builder))
public class Child extends Parent {
//Multiple markers at this line
// - Implicit super constructor Parent() is undefined. Must explicitly invoke another constructor
// - overrides java.lang.Object.toString
private String a;
private int b;
private boolean c;
}
@Builder
public class Parent {
private double d;
private float e;
}
我需要能够建立子实例,使得
Child child = Child.builder().a("aVal").b(1000).c(true).d(10.1).e(20.0F).build();
但到目前为止,我得到的侧提到,代码注释错误。任何人都可以指出我如何通过lombok或任何其他类似的库实现它的正确方向?
子问题
为什么@AllArgsConstructor([email protected]__(@Autowired))
编译但@AllArgsConstructor([email protected]__(@Builder))
不?
我想目前评估https://github.com/rzwitserloot/lombok/pull/1337/commits。 – zur