aboutsummaryrefslogtreecommitdiff
path: root/Week9/src/com/camilstaps/shop/Article.java
blob: 92b496f72c22fb98a8a8876209b2865f853b75d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 user who added the article
     */
    private final User user;

    /**
     * Straightforwardly creating a new article
     * @param user
     * @param name
     * @param category
     * @param price
     */
    public Article(User user, String name, Category category, float price) {
        this.user = user;
        this.name = name;
        this.category = category;
        this.price = price;
    }
    
    public User getUser() {
        return user;
    }
    
    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);
    }

}