public final class Books extends AbstractBookList
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
private Set<Book> |
books
The collection of Books
|
private Set<BookDriver> |
drivers
An array of BookDrivers
|
private Map<String,Book> |
initials
The map of book initials
|
private static Books |
instance
The singleton instance.
|
private static org.slf4j.Logger |
log
The log stream
|
private Map<String,Book> |
names
The map of book names
|
Modifier | Constructor and Description |
---|---|
private |
Books()
Create a singleton instance of the class.
|
Modifier and Type | Method and Description |
---|---|
void |
addBook(Book book)
Add a Book to the current list of Books.
|
private void |
autoRegister()
Registers all the drivers known to the program.
|
Book |
getBook(String name)
Search for the book by initials and name.
|
List<Book> |
getBooks()
Get a list of all the Books of all types.
|
List<Book> |
getBooks(BookFilter filter)
Get a filtered list of all the Books.
|
BookDriver[] |
getDrivers()
Get an array of all the known drivers
|
BookDriver[] |
getDriversByClass(Class<? extends BookDriver> type)
Since Books keeps a track of drivers itself, including creating them when
registered it can be hard to get a hold of the current book driver.
|
static Books |
installed()
Accessor for the singleton instance
|
void |
registerDriver(BookDriver driver)
Register the driver, adding its books to the list.
|
void |
removeBook(Book book)
Remove a Book from the current list of Books.
|
addBooksListener, fireBooksChanged, removeBooksListener
private Set<BookDriver> drivers
private static final org.slf4j.Logger log
private static final Books instance
private Books()
public static Books installed()
public List<Book> getBooks()
BookList
public List<Book> getBooks(BookFilter filter)
BookList
getBooks
in interface BookList
getBooks
in class AbstractBookList
filter
- the filter to apply to the list of booksBookFilters
public Book getBook(String name)
name
- The initials or name of the book to findpublic void addBook(Book book)
book
- the book to add to this book listpublic void removeBook(Book book) throws BookException
book
- the book to be removed from this book listBookException
- when an error occurs when performing this methodpublic void registerDriver(BookDriver driver) throws BookException
driver
- The BookDriver to addBookException
- when an error occurs when performing this methodpublic BookDriver[] getDriversByClass(Class<? extends BookDriver> type)
type
- the type of BookDriverpublic BookDriver[] getDrivers()
private void autoRegister()