From 4d45e0bc9afacc8408295aef50b8fd6530f97104 Mon Sep 17 00:00:00 2001 From: Cow Date: Mon, 4 May 2020 13:25:39 +0200 Subject: Re-organized packages and files --- .../java/eu/olli/cowmoonication/data/Friend.java | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/main/java/eu/olli/cowmoonication/data/Friend.java (limited to 'src/main/java/eu/olli/cowmoonication/data/Friend.java') diff --git a/src/main/java/eu/olli/cowmoonication/data/Friend.java b/src/main/java/eu/olli/cowmoonication/data/Friend.java new file mode 100644 index 0000000..69741e2 --- /dev/null +++ b/src/main/java/eu/olli/cowmoonication/data/Friend.java @@ -0,0 +1,65 @@ +package eu.olli.cowmoonication.data; + +import java.util.Objects; +import java.util.UUID; + +public class Friend { + public static final Friend FRIEND_NOT_FOUND = new Friend(); + 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); + } +} -- cgit