Is it better to use wrapper classes data type for the parameters in the builder pattern and then transform to primitive during build method to its primitive data type or is it better to use primitive data types throughout the builder pattern and do all data transformation of nullable data types in the controllers or the methods that calls the builder pattern?
public Builder recent(final Boolean recent) {
if (recent != null) {
this.recent = recent;
}
return this;
}
vs
public Builder recent(final boolean recent) {
this.recent = recent;
return this;
}
Aucun commentaire:
Enregistrer un commentaire