Add owner Sone to image.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Image.java
1 /*
2  * Sone - Image.java - Copyright © 2011 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 import java.util.UUID;
21
22 /**
23  * Container for image metadata.
24  *
25  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
26  */
27 public class Image {
28
29         /** The ID of the image. */
30         private final String id;
31
32         /** The Sone the image belongs to. */
33         private final Sone sone;
34
35         /** The key of the image. */
36         private final String key;
37
38         /** The creation time of the image. */
39         private final long creationTime;
40
41         /** The width of the image. */
42         private final int width;
43
44         /** The height of the image. */
45         private final int height;
46
47         /** The title of the image. */
48         private String title;
49
50         /** The description of the image. */
51         private String description;
52
53         /**
54          * Creates a new image.
55          *
56          * @param sone
57          *            The Sone the image belongs to
58          * @param key
59          *            The key of the image
60          * @param creationTime
61          *            The creation time of the image
62          * @param width
63          *            The width of the image
64          * @param height
65          *            The height of the image
66          */
67         public Image(Sone sone, String key, long creationTime, int width, int height) {
68                 this(UUID.randomUUID().toString(), sone, key, creationTime, width, height);
69         }
70
71         /**
72          * Creates a new image.
73          *
74          * @param id
75          *            The ID of the image
76          * @param sone
77          *            The Sone the image belongs to
78          * @param key
79          *            The key of the image
80          * @param creationTime
81          *            The creation time of the image
82          * @param width
83          *            The width of the image
84          * @param height
85          *            The height of the image
86          */
87         public Image(String id, Sone sone, String key, long creationTime, int width, int height) {
88                 this.id = id;
89                 this.sone = sone;
90                 this.key = key;
91                 this.creationTime = creationTime;
92                 this.width = width;
93                 this.height = height;
94         }
95
96         //
97         // ACCESSORS
98         //
99
100         /**
101          * Returns the ID of this image.
102          *
103          * @return The ID of this image
104          */
105         public String getId() {
106                 return id;
107         }
108
109         /**
110          * Returns the Sone this image belongs to.
111          *
112          * @return The Sone this image belongs to
113          */
114         public Sone getSone() {
115                 return sone;
116         }
117
118         /**
119          * Returns the key of this image.
120          *
121          * @return The key of this image
122          */
123         public String getKey() {
124                 return key;
125         }
126
127         /**
128          * Returns the creation time of this image.
129          *
130          * @return The creation time of this image (in milliseconds since 1970, Jan
131          *         1, UTC)
132          */
133         public long getCreationTime() {
134                 return creationTime;
135         }
136
137         /**
138          * Returns the width of this image.
139          *
140          * @return The width of this image (in pixels)
141          */
142         public int getWidth() {
143                 return width;
144         }
145
146         /**
147          * Returns the height of this image.
148          *
149          * @return The height of this image (in pixels)
150          */
151         public int getHeight() {
152                 return height;
153         }
154
155         /**
156          * Returns the title of this image.
157          *
158          * @return The title of this image
159          */
160         public String getTitle() {
161                 return title;
162         }
163
164         /**
165          * Sets the title of this image.
166          *
167          * @param title
168          *            The title of this image
169          * @return This image
170          */
171         public Image setTitle(String title) {
172                 this.title = title;
173                 return this;
174         }
175
176         /**
177          * Returns the description of this image.
178          *
179          * @return The description of this image
180          */
181         public String getDescription() {
182                 return description;
183         }
184
185         /**
186          * Sets the description of this image.
187          *
188          * @param description
189          *            The description of this image
190          * @return This image
191          */
192         public Image setDescription(String description) {
193                 this.description = description;
194                 return this;
195         }
196
197 }