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 ...

Get Core Java™ Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.