The one problem with this approach is that you would have to physically replace the Stock class with a new one when you changed the implementation. You can get around this by using an intermediate model, which is configurable. As an exercise, here’s the Stock class rewritten to be configurable.
To begin, you need to define an interface that the new class will use to talk to all of the possible implementation-level classes. This interface, StockInterface, is shown in Listing 9.2.
package stocktrack; import stocktrack.torque.StockPriceHistory; /** * <p>Title: Stock Tracking Application</p> * <p>Description: Example application from the book: * Struts - Rapid Working Knowledge</p> ...