Hi all,
I'm working with a swing application that does not connect to the internet. It does connect to a database. Before it can do that, it needs to read the IP address of the database from an XML config file that is resident on the local machine. If the app is ported to another computer, the IP could change which is why it's in the config. (that's out of my control). I need a class to hold the IP address so the app can connect to the database. So when the app starts, it reads the config.xml, connects to the database and performs queries. I'd also like to add some more values to the properties of this configuration class after some more queries have been run and results returned. For instance, if I were building a volkswagon, the number of seats, and engine size would be different than if I were building a Ferrari. These results would be returned from the queries. If I create a static instance variable and get an instance of the class, all the information I need would be there or I could add new information as more queries and results are returned. I'd like to avoid using setters but since the class holds a lot of information, the constructor would be ugly with all of the parameters necessary. Does this sound like a candidate for a builder
pattern? My understanding is that a factory pattern would create the same type of object every time and I might not need all of the properties. I need the properties available though in case I want to build a Ferrari instead of a Volkswagon. As the user makes choices, I want to add to this class and use its properties to drive other area's of the app without having to return to the database all the time.