aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper/cowlection/data/Friend.java
blob: 9ef368ed308daf3f5d9e81d3d43127735f95db6a (plain)
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
package de.cowtipper.cowlection.data;

import java.util.Objects;
import java.util.UUID;

public class Friend {
    public static final Friend FRIEND_NOT_FOUND = new Friend();
    @SuppressWarnings("unused")
    private UUID id;
    private String name;
    private long lastChecked;

    static {
        // uuid & name are null
        FRIEND_NOT_FOUND.setLastChecked(0);
    }

    /**
     * No-args constructor for GSON
     */
    private Friend() {
        this.lastChecked = System.currentTimeMillis();
    }

    public UUID getUuid() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getLastChecked() {
        return lastChecked;
    }

    public void setLastChecked(long lastChecked) {
        this.lastChecked = lastChecked;
    }

    @Override
    public String toString() {
        return "Friend{" +
                "uuid=" + id +
                ", name='" + name + '\'' +
                ", lastChecked=" + lastChecked +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Friend friend = (Friend) o;
        return Objects.equals(id, friend.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}