X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Frhynodge%2Ffilters%2Fwebpages%2Fsavoy%2FPerformance.java;h=c50dd31731bffe83262aa2b79d287a91584986e7;hb=65ea9a5bde3922ab14edda0deb8f8350e89f37c6;hp=4585e6e14f8f95a8271e2644c9bb90bb4d33bc87;hpb=d176fca28f0db80c67c7eb2cbb60638d213b9917;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java b/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java index 4585e6e..c50dd31 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java @@ -1,17 +1,24 @@ package net.pterodactylus.rhynodge.filters.webpages.savoy; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.time.LocalDateTime; -import java.util.Comparator; +import java.util.Objects; /** * Information about a performance and a link to buy a ticket. */ public class Performance { + @JsonProperty private final LocalDateTime time; + + @JsonProperty private final String link; - public static final Comparator byTime = (leftPerformance, rightPerformance) -> leftPerformance.getTime().compareTo(rightPerformance.getTime()); + public Performance() { + this(null, null); + } public Performance(LocalDateTime time, String link) { this.time = time; @@ -26,4 +33,17 @@ public class Performance { return link; } + @Override + public int hashCode() { + return Objects.hash(time, link); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Performance that = (Performance) o; + return Objects.equals(time, that.time) && Objects.equals(link, that.link); + } + }