diff options
| author | Camil Staps | 2015-04-18 13:44:44 +0200 |
|---|---|---|
| committer | Camil Staps | 2015-04-18 13:44:44 +0200 |
| commit | 6a44b074f0169a1b0f9e92347af929c5e471746e (patch) | |
| tree | ae5663fe7c69881bf4ecfedbef99c2505f8ec964 /Week9 Webshop/src/com/camilstaps/shop/Article.java | |
| parent | Added copyright to docs (diff) | |
Reorganised projects
Diffstat (limited to 'Week9 Webshop/src/com/camilstaps/shop/Article.java')
| -rw-r--r-- | Week9 Webshop/src/com/camilstaps/shop/Article.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/Week9 Webshop/src/com/camilstaps/shop/Article.java b/Week9 Webshop/src/com/camilstaps/shop/Article.java new file mode 100644 index 0000000..d22a323 --- /dev/null +++ b/Week9 Webshop/src/com/camilstaps/shop/Article.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2015 Camil Staps <info@camilstaps.nl> + * See the LICENSE file for copying permission. + */ + +package com.camilstaps.shop; + +import java.io.File; + +/** + * An Article in the webshop + * @author Camil Staps, s4498062 + */ +public class Article extends DatabaseItem { + + /** + * Basic data about the article + */ + private final String name; + private String description; + private final Category category; + private File multimedia; + private final float price; + + /** + * The owner who added the article + */ + private final User owner; + + /** + * Straightforwardly creating a new article + * @param user + * @param name + * @param category + * @param price + */ + public Article(User user, String name, Category category, float price) { + this.owner = user; + this.name = name; + this.category = category; + this.price = price; + } + + public User getOwner() { + return owner; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public Category getCategory() { + return category; + } + + public File getMultimedia() { + return multimedia; + } + + public float getPrice() { + return price; + } + + /** + * Set a new description + * @param description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Set multimedia + * @param multimedia + */ + public void setMultimedia(File multimedia) { + this.multimedia = multimedia; + } + + @Override + public String toString() { + return name + " (" + category.getName() + "): " + Float.toString(price); + } + +}
\ No newline at end of file |
