public class BookFactory extends Object
Constructor and Description |
---|
BookFactory()
Create a new empty BookFactory
|
BookFactory(String bookFilename)
Create a new BookFactory and fill it with information from a JSON file
|
Modifier and Type | Method and Description |
---|---|
Book |
getBook(int index)
Looks for a Book with the given id
|
Book |
getBook(String title)
Linear search through the array list for Book with the given Title
|
Book |
newBook(String title,
String status)
Adds a new Book into this class
|
void |
setBookFileName(String bookFilename)
Update the output filename for the object
|
void |
toJsonFile()
Output the data into a JSON file replacing the input file (or if filename not given, "books.json")
|
void |
update(Book oldBook,
Book newBook)
Replacing a Book in the array list with a new Book
|
public BookFactory()
public BookFactory(String bookFilename)
bookFilename
- Name of the input JSON filepublic void toJsonFile()
public void setBookFileName(String bookFilename)
bookFilename
- The new filenamepublic Book newBook(String title, String status)
title
- Title of the Bookstatus
- Status of the Bookpublic Book getBook(int index)
index
- id of the Book to be foundpublic Book getBook(String title)
title
- Title of the Book to be foundCopyright © 2017. All rights reserved.