O'Reilly logo

Struts Kick Start by Kevin Bedell, James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Further Isolation Techniques

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.

Listing 9.2. StockInterface.java
 package stocktrack; import stocktrack.torque.StockPriceHistory; /** * <p>Title: Stock Tracking Application</p> * <p>Description: Example application from the book: * Struts - Rapid Working Knowledge</p> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required