Don’t try to load properties for an empty list.
[demoscenemusic.git] / src / main / java / net / pterodactylus / demoscenemusic / data / DefaultTrack.java
index 9901fcb..0c01a2c 100644 (file)
@@ -135,6 +135,24 @@ public class DefaultTrack extends DefaultBase implements Track {
         */
        @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();
        }
@@ -148,4 +166,45 @@ public class DefaultTrack extends DefaultBase implements Track {
                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());
+       }
+
 }