构造函数可以很容易地在eclipse中生成。但是,构造函数能否以某种方式生成并执行空检查?例如:
public class A {
private B b;
private C c;
//I need to auto-generate this type of constructor for many of my classes in Eclipse
public A(B b, C c) {
this.b = Objects.requireNonNull(b);
this.c = Objects.requireNonNull(c);
}
}
这可能吗?