Override Object.hashCode() and Object.equals().
[demoscenemusic.git] / src / main / java / net / pterodactylus / demoscenemusic / data / DefaultTrack.java
index b357517..0c01a2c 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.demoscenemusic.data;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Default implementation of a track data container.
@@ -94,4 +95,116 @@ public class DefaultTrack extends DefaultBase implements Track {
                return this;
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public String getRemix() {
+               return getValue("remix", String.class).get();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public Track setRemix(String remix) {
+               getValue("remix", String.class).set(remix);
+               return this;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       public List<Artist> getRemixArtists() {
+               return getValue("remixArtists", List.class).get();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public Track setRemixArtists(List<Artist> remixArtists) {
+               getValue("remixArtists", List.class).set(remixArtists);
+               return this;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       public Collection<TrackDerivative> getDerivatives() {
+               return getValue("derivatives", Collection.class).get();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public Track setDerivatives(Collection<TrackDerivative> derivatives) {
+               getValue("derivatives", Collection.class).set(derivatives);
+               return this;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       public Map<Relationship, Collection<Track>> getRelatedTracks() {
+               return getValue("relatedTracks", Map.class).get();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public Track setRelatedTracks(Map<Relationship, Collection<Track>> relatedTracks) {
+               getValue("relatedTracks", Map.class).set(relatedTracks);
+               return this;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       public Collection<Party> getParties() {
+               return getValue("parties", Collection.class).get();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public Track setParties(Collection<Party> parties) {
+               getValue("parties", Collection.class).set(parties);
+               return this;
+       }
+
+       //
+       // OBJECT METHODS
+       //
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public int hashCode() {
+               return getId().hashCode();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public boolean equals(Object object) {
+               if (!(object instanceof Track)) {
+                       return false;
+               }
+               return ((Track) object).getId().equals(getId());
+       }
+
 }