mardi 14 septembre 2021

Is it mandatory for a factory to have a superclass?

I'm making a spring boot app which operates with many SOAP services.

I created 2 factories that generate the requests for each one of the possible soap operations I will use, however, they both receive different arguments. I didn't make a superclass for them yet and I injected them to my service main class. Is this a good design? Maybe 'factory' is a bad name for them.

private RetrieveComissionsFactory retrieveComissionsFactory;
private EditCommissionsFactory editCommissionsFactory;
private BGBAHeaderFactory bgbaHeaderFactory;

@Autowired
public SoapServiceImpl(RetrieveComissionsFactory retrieveComissionsFactory, EditCommissionsFactory editCommissionsFactoryy) {
    this.retrieveComissionsFactory = retrieveComissionsFactory;
    this.editCommissionsFactory = editCommissionsFactory;
}

Is this a good approach? Or there is any other way to use them?

I'm using these two factories to create the requests I must send to SOAP, and like I said, they receive different arguments.

Use examples:

CommissionsRetrieveRequest request = retrieveComissionsFactory.createRetrieveCommissionsRequest(date);

RegisterCommissionRequest request = editCommissionsFactory.createRegisterCommissionsRequest(change, operador,
                authorizing, fromDate);

Aucun commentaire:

Enregistrer un commentaire