summaryrefslogtreecommitdiff
path: root/src/main/java/design/model/League.java
blob: 6621513f13256c5bad73a1d622e49a34b26ee298 (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
package design.model;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.Date;
import java.util.List;

public abstract class League {
    private int id;
    private final String name;
    private final Date registrationDate;
    private final Date startDate;
    private final Date endDate;
    private final Golfer owner;

    @JsonCreator
    protected League(int id, String name, Date registrationDate, Date startDate, Date endDate, Golfer owner, List<Match> schedule) {
        this.id = id;
        this.name = name;
        this.registrationDate = registrationDate;
        this.startDate = startDate;
        this.endDate = endDate;
        this.owner = owner;
    }

    public League(String name, Date registrationDate, Date startDate, Date endDate, Golfer owner) {
        this.id = -1;
        this.name = name;
        this.registrationDate = registrationDate;
        this.startDate = startDate;
        this.endDate = endDate;
        this.owner = owner;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public Date getRegistrationDate() {
        return registrationDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public Golfer getOwner() {
        return owner;
    }

    public void setId(int id) {
        assert this.id == -1;
        this.id = id;
    }
}