O'Reilly logo

Core Java™ Data Objects by Heiko Bobzin, Michael Vorburger, Keiron McCammon, Sameer Tyagi

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

15.4. BookOperation Class

The command pattern can be used to share common implementations of operations. This class provides an abstract implementation for common operations on books that other commands can share. Figure 15-3 shows the class diagram for a number of the use-cases.

Figure 15-3. Inheriting from AbstractUseCase.

This class implements a number of convenience methods that can be used to do the following:

  • Query generic fields by passing “field” and “field value,”

  • Return found Book instance as a subclass.

  • Ensure that only a single instance result is returned; else an error is thrown.

  • Copies of a book can be found by “back pointer” or join ...

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