I'm having a special case where I have implemented builder pattern. One of the variable is of type ExternalClassA, Where as the parameter passed to builder is of type InternalClassA. Currently I have used a method something like below:
Class Parent {
String variableX;
int variableY;
ExternalZ variableZ;
public static builder {
....
ExternalZ varz;
/* .. builder logic */
private builder withExternalZ(InternalZ internalZ) { //This is the transform method I'm using currently
this.variableZ.getSomeObject().setX(this.internalZ.getSomeObject().getX()); //Similar kind of lines making my transform method look ugly
}
}
Is there any way to make my withExternalZ method look simpler? Currently I'm out Mapper pattern and Java8 Function (As explained in http://ift.tt/17MYsBW).
If anyone has better and simpler approach, kindly share.
Aucun commentaire:
Enregistrer un commentaire