From a2724d76b5ac2499e16d18747b216695ed020fa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 1 Jan 2011 02:50:34 +0100 Subject: [PATCH] Add container for image data. --- .../java/net/pterodactylus/sone/data/Image.java | 180 +++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 src/main/java/net/pterodactylus/sone/data/Image.java diff --git a/src/main/java/net/pterodactylus/sone/data/Image.java b/src/main/java/net/pterodactylus/sone/data/Image.java new file mode 100644 index 0000000..cae2520 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/data/Image.java @@ -0,0 +1,180 @@ +/* + * Sone - Image.java - Copyright © 2011 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sone.data; + +import java.util.UUID; + +/** + * Container for image metadata. + * + * @author David ‘Bombe’ Roden + */ +public class Image { + + /** The ID of the image. */ + private final String id; + + /** The key of the image. */ + private final String key; + + /** The creation time of the image. */ + private final long creationTime; + + /** The width of the image. */ + private final int width; + + /** The height of the image. */ + private final int height; + + /** The title of the image. */ + private String title; + + /** The description of the image. */ + private String description; + + /** + * Creates a new image. + * + * @param key + * The key of the image + * @param creationTime + * The creation time of the image + * @param width + * The width of the image + * @param height + * The height of the image + */ + public Image(String key, long creationTime, int width, int height) { + this(UUID.randomUUID().toString(), key, creationTime, width, height); + } + + /** + * Creates a new image. + * + * @param id + * The ID of the image + * @param key + * The key of the image + * @param creationTime + * The creation time of the image + * @param width + * The width of the image + * @param height + * The height of the image + */ + public Image(String id, String key, long creationTime, int width, int height) { + this.id = id; + this.key = key; + this.creationTime = creationTime; + this.width = width; + this.height = height; + } + + // + // ACCESSORS + // + + /** + * Returns the ID of this image. + * + * @return The ID of this image + */ + public String getId() { + return id; + } + + /** + * Returns the key of this image. + * + * @return The key of this image + */ + public String getKey() { + return key; + } + + /** + * Returns the creation time of this image. + * + * @return The creation time of this image (in milliseconds since 1970, Jan + * 1, UTC) + */ + public long getCreationTime() { + return creationTime; + } + + /** + * Returns the width of this image. + * + * @return The width of this image (in pixels) + */ + public int getWidth() { + return width; + } + + /** + * Returns the height of this image. + * + * @return The height of this image (in pixels) + */ + public int getHeight() { + return height; + } + + /** + * Returns the title of this image. + * + * @return The title of this image + */ + public String getTitle() { + return title; + } + + /** + * Sets the title of this image. + * + * @param title + * The title of this image + * @return This image + */ + public Image setTitle(String title) { + this.title = title; + return this; + } + + /** + * Returns the description of this image. + * + * @return The description of this image + */ + public String getDescription() { + return description; + } + + /** + * Sets the description of this image. + * + * @param description + * The description of this image + * @return This image + */ + public Image setDescription(String description) { + this.description = description; + return this; + } + +} -- 2.7.4