The problem at hand is to identify Owners based on some logic then return back an object with all of those Owners. So if client needs 3 Owner then return back an object with those 3 Owners. Example: Owner A, Owner B, Owner C. That object will then be used to add on to another object, Account, that will be send to the Database.
I was thinking of creating an OwnerIdentifier interface that classes can implement. Then have a class that has a method that takes in a variable arguments that will iterate through all the OwnerIdentifier concrete implementation and the method returns back a Map<Owner, String>. Owner is an Enum type and String is the owner alias. Once I have the map I can use that to build the model.
HOWEVER, I'm not sure if that is really the best approach...... Because I would have to then map the values in the Map to a particular field in the Account object. Then if new type of Owner are added, I would have to change the Account object...
Any suggestions would help a lot!!!
Aucun commentaire:
Enregistrer un commentaire