Remove @author tags
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Image.java
1 /*
2  * Sone - Image.java - Copyright © 2011–2016 David Roden
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.pterodactylus.sone.data;
19
20 /**
21  * Container for image metadata.
22  */
23 public interface Image extends Identified, Fingerprintable {
24
25         /**
26          * Returns the ID of this image.
27          *
28          * @return The ID of this image
29          */
30         String getId();
31
32         /**
33          * Returns the Sone this image belongs to.
34          *
35          * @return The Sone this image belongs to
36          */
37         Sone getSone();
38
39         /**
40          * Returns the album this image belongs to.
41          *
42          * @return The album this image belongs to
43          */
44         Album getAlbum();
45
46         /**
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)}.
49          *
50          * @param album
51          *            The album this image belongs to
52          * @return This image
53          */
54         Image setAlbum(Album album);
55
56         /**
57          * Returns the request key of this image.
58          *
59          * @return The request key of this image
60          */
61         String getKey();
62
63         /**
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
66          * {@code null}.
67          *
68          * @return {@code true} if there is a key for this image, {@code false}
69          *         otherwise
70          */
71         boolean isInserted();
72
73         /**
74          * Returns the creation time of this image.
75          *
76          * @return The creation time of this image (in milliseconds since 1970, Jan
77          *         1, UTC)
78          */
79         long getCreationTime();
80
81         /**
82          * Returns the width of this image.
83          *
84          * @return The width of this image (in pixels)
85          */
86         int getWidth();
87
88         /**
89          * Returns the height of this image.
90          *
91          * @return The height of this image (in pixels)
92          */
93         int getHeight();
94
95         /**
96          * Returns the title of this image.
97          *
98          * @return The title of this image
99          */
100         String getTitle();
101
102         /**
103          * Returns the description of this image.
104          *
105          * @return The description of this image
106          */
107         String getDescription();
108
109         /**
110          * {@inheritDoc}
111          */
112         @Override
113         String getFingerprint();
114
115         Modifier modify() throws IllegalStateException;
116
117         interface Modifier {
118
119                 Modifier setSone(Sone sone);
120
121                 Modifier setCreationTime(long creationTime);
122
123                 Modifier setKey(String key);
124
125                 Modifier setTitle(String title);
126
127                 Modifier setDescription(String description);
128
129                 Modifier setWidth(int width);
130
131                 Modifier setHeight(int height);
132
133                 Image update() throws IllegalStateException;
134
135                 class ImageTitleMustNotBeEmpty extends IllegalStateException { }
136
137         }
138
139 }