The Author Object

The Product object makes use of the Author object because a product has a reference to the authors of the book. So, you need to implement the Author object now as well. The Author object, by the way, is extremely simple, as Listing 9.7 shows.

Listing 9.7. Author.Java
 package com.bfg.product; import java.util.Vector; import java.util.HashMap; public class Author { protected static HashMap authors = new HashMap(); protected Vector pBooks = new Vector(); protected String pName; public Vector getBooks() { return pBooks; } public void setBooks(Vector Books) { pBooks = Books; } public String getName() { return pName; } public void setName(String Name) { pName = Name; } public static Author findAuthor(String name) { if (authors.get(name) ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL 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.