I am working on a project based on the Java EE technology. First I'd like to tell you what I want to achieve, then what I already tried.
Task:
Imagine two types of configurations, which you want to choose and edit/define in the JEE application via GUI entries. Config A is for the communication with System A and Config B is for the communication with System B.
Config A got a few properties equal to Config B, but the properties itself differ in some way (example: enumerations). Additionally Config A and B each got more properties which they don't have in common. Now, if the application user enters one configuration(A or B) it should be possible to access in a general and easy way all given methods/properties of the configurations, without always asking which type of configuration was picked. How can one access especially the properties/methods that differ, in an easy and not redundant way?
Current setup:
Because I try to reduce redundant code I created an abstract class defining a general configuration, let's call it "GeneralConfiguration".
Config A and B each extend GeneralConfiguration. For each "shared" property GeneralConfiguration defines an interface. Each interface got implemented by different enums, which represent the possible entries for the general configuration depending on the config type (A or B).
I think my setup is not optimal. So what do you think, how to handle this kind of task?