Class AssortmentImpl

  • All Implemented Interfaces:
    Assortment

    public class AssortmentImpl
    extends Object
    implements Assortment
    Implementation of the Assortment interface.
    Author:
    Maximilian Schiedermeier
    • 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 interface Assortment
        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 interface Assortment
        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 interface Assortment
        Parameters:
        bookDetails - for the exact data of the book to be added to the assortment.
      • toString

        public String toString()
        Converts the current assortment state to a human readable String.
        Overrides:
        toString in class Object
        Returns:
        current assortment as string.