I am running JSF 2.0
I currently have one java controller that is called Contacts.java. Inside there I have a list of addresses stored as a member variable
List<Addresses> addresses;
When my application loads it displays a bunch of contacts and you are able to click on a contact to "open it" to view its data. When you click on the contact the contactId is passed to a method that populates the List based on the contactId. It in turn then displays the data.
I also have a bunch of functionality that will add an address to the list, remove an address, updated etc. which are all dependent on this contactId.
I was considering splitting up my Contacts.java into two controllers Contacts.java and Addresses.java because there is just so much logic having to do with addresses that I figured it should be in its own class.
The issue that I am struggling with is that if I move all of the logic dealing with Addresses into Addresses.java it will need to somehow have a reference to the contactId that was selected after compile time.
At compile time Addresses will compile looking for the current contactId when it is populating the List addresses in the constructor. It will have not been set at this point though because the contactId is set when the user selects a contact in the application.
Is this a bad design idea ? I am very new to Java and OOP and have not full grasped the concepts of how to break these apart. Any help would be appreciated.