X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjshopcore%2Fmodel%2Fbasket%2FBasket.java;h=28d1eeb2735d84bf428598fc15b48c48b9b79068;hb=672084ab2c551cbff8c8c424780ed344f7c13925;hp=679200ae0a70a80d8fe38167850453223491170f;hpb=82754b37a3ea3ec3b71b67cad59b5c37d09fab77;p=jcustomer-core.git diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index 679200a..28d1eeb 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -16,94 +16,66 @@ */ package org.mxchange.jshopcore.model.basket; -import java.io.IOException; import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; -import java.sql.SQLException; -import java.util.Map; -import org.mxchange.jshopcore.model.item.AddableBasketItem; +import java.util.List; +import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException; /** * An interface for baskets - * - * @author Roland Haeder + *
+ * @author Roland Haeder
* @param item Item instance to add
- * @throws java.io.IOException If an IO error occurs
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.lang.NoSuchMethodException If a method was not found
- * @throws java.lang.IllegalAccessException If the invoked method is not public
- * @throws java.lang.reflect.InvocationTargetException If anything else happened?
- */
- public void addItem (final T item) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
- /**
- * Checks whether the given item as already been added. If the product's
- * item id number was found in basket, the corresponding item instance will be set
- *
- * @param item Item instance to check
- * @return Whether the given item has been found
- * @throws java.io.IOException If an IO error occurs
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.lang.NoSuchMethodException If a method was not found
- * @throws java.lang.IllegalAccessException If the invoked method is not public
- * @throws java.lang.reflect.InvocationTargetException If anything else happened?
- */
- public boolean isAdded (final T item) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
- /**
- * Checks if the basket is empty
- *
- * @return Whether the basket is empty
- * @throws java.io.IOException If an IO error occurs
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.lang.NoSuchMethodException If a method was not found
- * @throws java.lang.IllegalAccessException If the invoked method is not public
- * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException
+ * If the item instance has already been added
*/
- public boolean isEmpty () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public void addItem (final T item) throws BasketItemAlreadyAddedException;
/**
- * Initializes this instance with given ServletContext
- *
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.io.IOException If an IO error occurs
+ * Clears the basket instance
*/
- public void init () throws SQLException, IOException;
+ public void clear ();
/**
* Some "getter" for all entries in this basket
- *
+ *
* @return Map on all basket items
- * @throws java.io.IOException If an IO error occurs
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.lang.NoSuchMethodException If a method was not found
- * @throws java.lang.IllegalAccessException If the invoked method is not public
- * @throws java.lang.reflect.InvocationTargetException If anything else happened?
*/
- public Map
* @return Last added item in basket
- * @throws java.io.IOException If an IO error occurs
- * @throws java.sql.SQLException If an SQL error occurs
- * @throws java.lang.NoSuchMethodException If a method was not found
- * @throws java.lang.IllegalAccessException If the invoked method is not public
- * @throws java.lang.reflect.InvocationTargetException If anything else happened?
*/
- public AddableBasketItem getLast () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public T getLast ();
/**
* Getter for last num rows
- *
+ *
* @return Last num rows
*/
public int getLastNumRows ();
+
+ /**
+ * Checks whether the given item has already been added by checking the
+ * item's id.
+ *
+ * @param item Item instance to check
+ * @return Whether the given item has been found
+ */
+ public boolean isAdded (final T item);
+
+ /**
+ * Checks if the basket is empty
+ *
+ * @return Whether the basket is empty
+ */
+ public boolean isEmpty ();
}