2 * Sone - Image.java - Copyright © 2011–2019 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.data;
21 * Container for image metadata.
23 public interface Image extends Identified, Fingerprintable {
26 * Returns the ID of this image.
28 * @return The ID of this image
33 * Returns the Sone this image belongs to.
35 * @return The Sone this image belongs to
40 * Returns the album this image belongs to.
42 * @return The album this image belongs to
47 * Sets the album this image belongs to. The album of an image can only be
48 * set once, and it is usually called by {@link Album#addImage(Image)}.
51 * The album this image belongs to
54 Image setAlbum(Album album);
57 * Returns the request key of this image.
59 * @return The request key of this image
64 * Returns whether the image has already been inserted. An image is
65 * considered as having been inserted it its {@link #getKey() key} is not
68 * @return {@code true} if there is a key for this image, {@code false}
74 * Returns the creation time of this image.
76 * @return The creation time of this image (in milliseconds since 1970, Jan
79 long getCreationTime();
82 * Returns the width of this image.
84 * @return The width of this image (in pixels)
89 * Returns the height of this image.
91 * @return The height of this image (in pixels)
96 * Returns the title of this image.
98 * @return The title of this image
103 * Returns the description of this image.
105 * @return The description of this image
107 String getDescription();
113 String getFingerprint();
115 Modifier modify() throws IllegalStateException;
119 Modifier setSone(Sone sone);
121 Modifier setCreationTime(long creationTime);
123 Modifier setKey(String key);
125 Modifier setTitle(String title);
127 Modifier setDescription(String description);
129 Modifier setWidth(int width);
131 Modifier setHeight(int height);
133 Image update() throws IllegalStateException;
135 class ImageTitleMustNotBeEmpty extends IllegalStateException { }