From: Roland Haeder Date: Tue, 15 Sep 2015 13:25:32 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cfe7224d4385196244c556167c84c5593bddf252;p=jcustomer-core.git Continued: - added checkout wrapper class and interface - added method clear() for clearing the basket Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java index 06755b1..def5926 100644 --- a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java @@ -130,4 +130,10 @@ public abstract class BaseBasket implements Basket< // Return it return isAdded; } + + @Override + public void clear () { + // Deligate to deque + this.deque.clear(); + } } diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index f0824bb..ea7e899 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -36,6 +36,11 @@ public interface Basket extends Serializable { */ public void addItem (final T item) throws BasketItemAlreadyAddedException; + /** + * Clears the basket instance + */ + public void clear (); + /** * Checks whether the given item has already been added by checking the * item's id. diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java new file mode 100644 index 0000000..2ee6882 --- /dev/null +++ b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jshopcore.wrapper; + +import java.util.List; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; +import org.mxchange.jshopcore.model.customer.Customer; + +/** + * A wrapper for checkouts (customer, ordered items) + * + * @author Roland Haeder + */ +public class CheckoutWrapper implements WrapableCheckout { + /** + * Serial number + */ + private static final long serialVersionUID = 94_358_758_475_481_781L; + + /** + * Customer instance + */ + private Customer customer; + + /** + * List instance + */ + private List list; + + /** + * Default constructor + */ + public CheckoutWrapper () { + } + + public Customer getCustomer () { + return this.customer; + } + + public void setCustomer (final Customer customer) { + this.customer = customer; + } + + public List getList () { + return this.list; + } + + public void setList (final List list) { + this.list = list; + } + +} diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java new file mode 100644 index 0000000..7d5d9db --- /dev/null +++ b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jshopcore.wrapper; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; +import org.mxchange.jshopcore.model.customer.Customer; + +/** + * An interface for checkout wrapper + * + * @author Roland Haeder + */ +public interface WrapableCheckout extends Serializable { + + /** + * Getter for customer instance + * + * @return Customer indstance + */ + public Customer getCustomer (); + + /** + * Setter for customer instance + * @param customer Customer instance + */ + public void setCustomer (final Customer customer); + + /** + * Getter for a List of AddableBasktem instances + * @return List with AddableBasketItem instances + */ + public List getList (); + + /** + * Setter for a List of AddableBasktem instances + * @param list List with AddableBasketItem instances + */ + public void setList (final List list); +}