I have been doing research on the factory design pattern and was wondering if the below example, while not "textbook" is technically a correct use of it. Is there another design pattern that may fit the situation better?
public class MySimpleObjectFactory {
private SomeTransformer someTransformer;
public MySimpleObjectFactory(SomeTransformer someTransformer){
this.someTransformer = someTransformer;
}
public SimpleObject getSimpleObject(SomeObject someObject){
PropA propA = someTransformer.transform(someObject);
return SimpleObject.builder()
.propA(propA)
.build();
}
public SimpleObject getSimpleObject(SomeObject someObject, AnotherObject anotherObject){
PropA propA = someTransformer.transform(someObject, anotherObject);
return SimpleObject.builder()
.propA(propA)
.build();
}
public SimpleObject getSimpleObject(SomeObject someObject, AnotherObject anotherObject, YetAnotherObject yetAnotherObject){
PropA propA = someTransformer.transform(someObject, anotherObject, yetAnotherObject);
return SimpleObject.builder()
.propA(propA)
.build();
}
}