1 /* 2 * Copyright 2004 Sun Microsystems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 package com.sun.syndication.feed.rss; 18 19 import com.sun.syndication.feed.impl.ObjectBean; 20 21 import java.io.Serializable; 22 23 /** 24 * Bean for images of RSS feeds. 25 * <p> 26 * @author Alejandro Abdelnur 27 * 28 */ 29 public class Image implements Cloneable,Serializable { 30 private ObjectBean _objBean; 31 private String _title; 32 private String _url; 33 private String _link; 34 private int _width = -1; 35 private int _height = -1; 36 private String _description; 37 38 /** 39 * Default constructor. All properties are set to <b>null</b>. 40 * <p> 41 * 42 */ 43 public Image() { 44 _objBean = new ObjectBean(this.getClass(),this); 45 } 46 47 /** 48 * Creates a deep 'bean' clone of the object. 49 * <p> 50 * @return a clone of the object. 51 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned. 52 * 53 */ 54 public Object clone() throws CloneNotSupportedException { 55 return _objBean.clone(); 56 } 57 58 /** 59 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method. 60 * <p> 61 * @param other he reference object with which to compare. 62 * @return <b>true</b> if 'this' object is equal to the 'other' object. 63 * 64 */ 65 public boolean equals(Object other) { 66 return _objBean.equals(other); 67 } 68 69 /** 70 * Returns a hashcode value for the object. 71 * <p> 72 * It follows the contract defined by the Object hashCode() method. 73 * <p> 74 * @return the hashcode of the bean object. 75 * 76 */ 77 public int hashCode() { 78 return _objBean.hashCode(); 79 } 80 81 /** 82 * Returns the String representation for the object. 83 * <p> 84 * @return String representation for the object. 85 * 86 */ 87 public String toString() { 88 return _objBean.toString(); 89 } 90 91 /** 92 * Returns the image title. 93 * <p> 94 * @return the image title, <b>null</b> if none. 95 * 96 */ 97 public String getTitle() { 98 return _title; 99 } 100 101 /** 102 * Sets the image title. 103 * <p> 104 * @param title the image title to set, <b>null</b> if none. 105 * 106 */ 107 public void setTitle(String title) { 108 _title = title; 109 } 110 111 /** 112 * Returns the image URL. 113 * <p> 114 * @return the image URL, <b>null</b> if none. 115 * 116 */ 117 public String getUrl() { 118 return _url; 119 } 120 121 /** 122 * Sets the image URL. 123 * <p> 124 * @param url the image URL to set, <b>null</b> if none. 125 * 126 */ 127 public void setUrl(String url) { 128 _url = url; 129 } 130 131 /** 132 * Returns the image link. 133 * <p> 134 * @return the image link, <b>null</b> if none. 135 * 136 */ 137 public String getLink() { 138 return _link; 139 } 140 141 /** 142 * Sets the image link. 143 * <p> 144 * @param link the image link to set, <b>null</b> if none. 145 * 146 */ 147 public void setLink(String link) { 148 _link = link; 149 } 150 151 /** 152 * Returns the image width. 153 * <p> 154 * @return the image width, <b>null</b> if none. 155 * 156 */ 157 public int getWidth() { 158 return _width; 159 } 160 161 /** 162 * Sets the image width. 163 * <p> 164 * @param width the image width to set, <b>null</b> if none. 165 * 166 */ 167 public void setWidth(int width) { 168 _width = width; 169 } 170 171 /** 172 * Returns the image height. 173 * <p> 174 * @return the image height, <b>null</b> if none. 175 * 176 */ 177 public int getHeight() { 178 return _height; 179 } 180 181 /** 182 * Sets the image height. 183 * <p> 184 * @param height the image height to set, <b>null</b> if none. 185 * 186 */ 187 public void setHeight(int height) { 188 _height = height; 189 } 190 191 /** 192 * Returns the image description. 193 * <p> 194 * @return the image description, <b>null</b> if none. 195 * 196 */ 197 public String getDescription() { 198 return _description; 199 } 200 201 /** 202 * Sets the image description. 203 * <p> 204 * @param description the image description to set, <b>null</b> if none. 205 * 206 */ 207 public void setDescription(String description) { 208 _description = description; 209 } 210 211 }