+ * @return The Sone this image belongs to
+ */
+ public Sone getSone() {
+ return sone;
+ }
+
+ /**
+ * Sets the owner of this image. The owner can only be set if no owner has
+ * yet been set.
+ *
+ * @param sone
+ * The new owner of this image
+ * @return This image
+ */
+ public Image setSone(Sone sone) {
+ checkNotNull(sone, "sone must not be null");
+ checkArgument((this.sone == null) || this.sone.equals(sone), "sone must not already be set to another sone");
+ this.sone = sone;
+ return this;
+ }
+
+ /**
+ * Returns the album this image belongs to.
+ *
+ * @return The album this image belongs to
+ */
+ public Album getAlbum() {
+ return album;
+ }
+
+ /**
+ * Sets the album this image belongs to. The album of an image can only be
+ * set once, and it is usually called by {@link Album#addImage(Image)}.
+ *
+ * @param album
+ * The album this image belongs to
+ * @return This image
+ */
+ public Image setAlbum(Album album) {
+ checkNotNull(album, "album must not be null");
+ checkNotNull(album.getSone().equals(getSone()), "album must belong to the same Sone as this image");
+ this.album = album;
+ return this;
+ }
+
+ /**
+ * Returns the request key of this image.
+ *
+ * @return The request key of this image