SO, I have class that uses @Builder lombok annotation. This is how it looks and how I use it:
import lombok.Builder;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonProperty;
@Data
@Builder
public class MyModel {
@JsonProperty(value = "myField1")
private String myField1;
@JsonProperty(value = "myField2")
private String myField2;
@JsonProperty(value = "myField3")
private String myField3;
}
//This is how I use it:
MyModel model = MyModel.builder()
.myField1("value for field 1")
.myField2("value for field 2")
.build();
My question is if it is a good practice or not to add some additional method to this class? Or I should leave it as it is and do any business logic outside??
Basically, lets say, I need a helper method to set myField3 property, because I CANNOT just to do:
.myField3("value for field 3")
.build()
I need to perform some actions on value for field3 and after that set it to MyModel.
So can I put this helper method to this class?