X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FAlbumImpl.java;h=b60e99e1032d0905b6fcd66c01e1eb590751f2a0;hp=f489b0b09548adde4bc654d4a76806e6483b2e39;hb=ec06ae64c86f0b06bb0cf9f8b289e7907e81dffa;hpb=62bb6456a7c2667dec2f8b7b88db465eb6c07257 diff --git a/src/main/java/net/pterodactylus/sone/data/AlbumImpl.java b/src/main/java/net/pterodactylus/sone/data/AlbumImpl.java index f489b0b..b60e99e 100644 --- a/src/main/java/net/pterodactylus/sone/data/AlbumImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/AlbumImpl.java @@ -47,7 +47,7 @@ public class AlbumImpl implements Album { private final String id; /** The Sone this album belongs to. */ - private Sone sone; + private final Sone sone; /** Nested albums. */ private final List albums = new ArrayList(); @@ -71,8 +71,8 @@ public class AlbumImpl implements Album { private String albumImage; /** Creates a new album with a random ID. */ - public AlbumImpl() { - this(UUID.randomUUID().toString()); + public AlbumImpl(Sone sone) { + this(sone, UUID.randomUUID().toString()); } /** @@ -81,7 +81,8 @@ public class AlbumImpl implements Album { * @param id * The ID of the album */ - public AlbumImpl(String id) { + public AlbumImpl(Sone sone, String id) { + this.sone = checkNotNull(sone, "Sone must not be null"); this.id = checkNotNull(id, "id must not be null"); } @@ -100,14 +101,6 @@ public class AlbumImpl implements Album { } @Override - public Album setSone(Sone sone) { - checkNotNull(sone, "sone must not be null"); - checkState((this.sone == null) || (this.sone.equals(sone)), "album owner must not already be set to some other Sone"); - this.sone = sone; - return this; - } - - @Override public List getAlbums() { return new ArrayList(albums); }