Class AssortmentImpl
- java.lang.Object
-
- eu.kartoffelquadrat.bookstoreinternals.AssortmentImpl
-
- All Implemented Interfaces:
Assortment
public class AssortmentImpl extends Object implements Assortment
Implementation of the Assortment interface.- Author:
- Maximilian Schiedermeier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBookToAssortment(BookDetailsImpl bookDetails)
Indexes a new book.BookDetailsImpl
getBookDetails(Long isbn)
Retrieved book details for a specific book, identified by isbn.Collection<Long>
getEntireAssortment()
Retrieves all books that are indexed, no matter if they are in stock somewhere or not.static Assortment
getInstance()
Singleton pattern instance retriever.String
toString()
Converts the current assortment state to a human readable String.
-
-
-
Method Detail
-
getInstance
public static Assortment getInstance()
Singleton pattern instance retriever. Always returns the same instance.- Returns:
- the one and only Assortment instance.
-
getEntireAssortment
public Collection<Long> getEntireAssortment()
Retrieves all books that are indexed, no matter if they are in stock somewhere or not.- Specified by:
getEntireAssortment
in interfaceAssortment
- Returns:
- the list off registered isbns.
-
getBookDetails
public BookDetailsImpl getBookDetails(Long isbn)
Retrieved book details for a specific book, identified by isbn.- Specified by:
getBookDetails
in interfaceAssortment
- Parameters:
isbn
- for the identifier of the book in question.- Returns:
- A BookDetail object, containing the static metadata of the requested book.
-
addBookToAssortment
public void addBookToAssortment(BookDetailsImpl bookDetails)
Indexes a new book. The isbn of the bookDetails parameter bean must not conflict with an existing book.- Specified by:
addBookToAssortment
in interfaceAssortment
- Parameters:
bookDetails
- for the exact data of the book to be added to the assortment.
-
-