Reputation: 4180
I am refactoring some legacy code, trying to use Lombok to make it a bit cleaner.
Right now the constructor of my class is defined as follows:
public class MyClass {
private final YourClass yourClass;
public MyClass(final A a, final B b) {
yourClass = new YourClass(a, b);
}
}
How do I use Lombok to make this happen?
Upvotes: 1
Views: 214
Reputation: 1184
If you have additional parameters of an arbitrary type, there is no way for Lombok (or any other annotation processing mechanism) to determine how you want your constructor to look like and behave.
You will have to define your own constructor or a static factory method. Or use the builder pattern.
Upvotes: 2