Let's say I have following class and a builder for it:
public class A(){
private B b;
private C c;
private A(Builder builder) {
this.b = builder.b;
this.c = bulder.c;
}
public static class Builder() {
private B b;
private C c;
public Builder setB(B b){
this.b = b;
return this;
}
public Builder setC(C c){
this.C = c;
return this;
}
public A build(){
return new A(this);
}
}
}
Now let's say that b and c need to be calculated somehow (for example, based on list of D). May question is:
Where to put filling parameters b and c based on some calculation, that is, should I place calculation in A, in builder, or somewhere else?
Aucun commentaire:
Enregistrer un commentaire