We have some veneers to skip builder's generation for some types that only contains one or two fields. In that case we need to generate the object initialising its struct directly.
In case of Java, you cannot initialise the struct directly like other languages. You need to initialise the object and after that setting their values after that. It is ugly since current generation makes everything public and set the values directly is not the "Java way".
So to simplify this pain, we could ask for the values into their constructor. In Java you can overload the constructors and methods, so probably the best way to cover it is to generate all these constructors.
For example:
public class MyClass {
public String a;
public Integer b;
}
should have:
public MyClass(String a, Integer b) {
this.a = a;
this.b = b;
}
public MyClass(String a) {
this.a = a;
}
public MyClass(Integer b) {
this.b = b;
}
If its complex, at least with the first constructor we can make it works. We are using objects for primitive types so null value is acceptable as argument.
We have some veneers to skip builder's generation for some types that only contains one or two fields. In that case we need to generate the object initialising its struct directly.
In case of Java, you cannot initialise the struct directly like other languages. You need to initialise the object and after that setting their values after that. It is ugly since current generation makes everything public and set the values directly is not the "Java way".
So to simplify this pain, we could ask for the values into their constructor. In Java you can overload the constructors and methods, so probably the best way to cover it is to generate all these constructors.
For example:
should have:
If its complex, at least with the first constructor we can make it works. We are using objects for primitive types so
null
value is acceptable as argument.If I'm not wrong, it can be fixed using veneers.