I am trying to use Lombok to minimise the line of codes I have to write to convert superclass object to a subclass object.
SuperClass:
@Data
public class SuperClass{
// lots of fields
}
SubClass:
@Data
public class SubClass extends SuperClass{
private String additionalField;
public SubClass(SuperClass super, String additionalField){
// set all available fields from superclass
this.additionalField = additionalField;
}
}
I trivial solution is to accept all arguments and set them accordingly, but I am looking for a minimum model that I need to only pass the additional arguments to the constructor.