1

Constructors can be generated in eclipse quite easily. But, can the constructors somehow be generated which also perform null check? Example:

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); 
    }

}

Is this possible?

Anmol Gupta
  • 2,797
  • 9
  • 27
  • 43

1 Answers1

-1

See tutorials like these :

Link1 and Link2

Community
  • 1
  • 1
Som Bhattacharyya
  • 3,972
  • 35
  • 54