Java Reference
In-Depth Information
SOLUTION 6.2
You have many choices about how to illustrate the class relationships in this example. Figure
B.6 shows one answer. Your figure should show the relationship between
JDBCAdapter
and
Statement
. In UML, the open arrowhead on the association between
JDBCAdapter
and
Statement
indicates that a
JDBCAdapter
object can use or navigate to a
Statement
object, but a
Statement
object cannot use a
JDBCAdapter
object.
Figure B.6. An
OzJDBCAdapter
object will throw a NoQuery exception if the adapter is
asked for data before a query has made data available.
Note that you cannot show the class that implements
Statement
, as the JDBC architecture
isolates you from knowing how a driver writer has named this class.
An illustration of the
OzJDBCAdapter
class should show the methods it overrides.
Figure B.6 also indicates that
OzJDBCAdapter
objects use a
hasQuery
Boolean to keep
track of whether they have received a query.