View Javadoc

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  import com.sun.syndication.feed.impl.ObjectBean;
21  
22  import java.io.Serializable;
23  
24  /***
25   * Bean for images of RSS feeds.
26   * <p>
27   * @author Alejandro Abdelnur
28   *
29   */
30  public class Image implements Cloneable,Serializable {
31      private ObjectBean _objBean;
32      private String _title;
33      private String _url;
34      private String _link;
35      private int _width = -1;
36      private int _height = -1;
37      private String _description;
38  
39      /***
40       * Default constructor. All properties are set to <b>null</b>.
41       * <p>
42       *
43       */
44      public Image() {
45          _objBean = new ObjectBean(this.getClass(),this);
46      }
47  
48      /***
49       * Creates a deep 'bean' clone of the object.
50       * <p>
51       * @return a clone of the object.
52       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
53       *
54       */
55      public Object clone() throws CloneNotSupportedException {
56          return _objBean.clone();
57      }
58  
59      /***
60       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
61       * <p>
62       * @param other he reference object with which to compare.
63       * @return <b>true</b> if 'this' object is equal to the 'other' object.
64       *
65       */
66      public boolean equals(Object other) {
67          return _objBean.equals(other);
68      }
69  
70      /***
71       * Returns a hashcode value for the object.
72       * <p>
73       * It follows the contract defined by the Object hashCode() method.
74       * <p>
75       * @return the hashcode of the bean object.
76       *
77       */
78      public int hashCode() {
79          return _objBean.hashCode();
80      }
81  
82      /***
83       * Returns the String representation for the object.
84       * <p>
85       * @return String representation for the object.
86       *
87       */
88      public String toString() {
89          return _objBean.toString();
90      }
91  
92      /***
93       * Returns the image title.
94       * <p>
95       * @return the image title, <b>null</b> if none.
96       *
97       */
98      public String getTitle() {
99          return _title;
100     }
101 
102     /***
103      * Sets the image title.
104      * <p>
105      * @param title the image title to set, <b>null</b> if none.
106      *
107      */
108     public void setTitle(String title) {
109         _title = title;
110     }
111 
112     /***
113      * Returns the image URL.
114      * <p>
115      * @return the image URL, <b>null</b> if none.
116      *
117      */
118     public String getUrl() {
119         return _url;
120     }
121 
122     /***
123      * Sets the image URL.
124      * <p>
125      * @param url the image URL to set, <b>null</b> if none.
126      *
127      */
128     public void setUrl(String url) {
129         _url = url;
130     }
131 
132     /***
133      * Returns the image link.
134      * <p>
135      * @return the image link, <b>null</b> if none.
136      *
137      */
138     public String getLink() {
139         return _link;
140     }
141 
142     /***
143      * Sets the image link.
144      * <p>
145      * @param link the image link to set, <b>null</b> if none.
146      *
147      */
148     public void setLink(String link) {
149         _link = link;
150     }
151 
152     /***
153      * Returns the image width.
154      * <p>
155      * @return the image width, <b>null</b> if none.
156      *
157      */
158     public int getWidth() {
159         return _width;
160     }
161 
162     /***
163      * Sets the image width.
164      * <p>
165      * @param width the image width to set, <b>null</b> if none.
166      *
167      */
168     public void setWidth(int width) {
169         _width = width;
170     }
171 
172     /***
173      * Returns the image height.
174      * <p>
175      * @return the image height, <b>null</b> if none.
176      *
177      */
178     public int getHeight() {
179         return _height;
180     }
181 
182     /***
183      * Sets the image height.
184      * <p>
185      * @param height the image height to set, <b>null</b> if none.
186      *
187      */
188     public void setHeight(int height) {
189         _height = height;
190     }
191 
192     /***
193      * Returns the image description.
194      * <p>
195      * @return the image description, <b>null</b> if none.
196      *
197      */
198     public String getDescription() {
199         return _description;
200     }
201 
202     /***
203      * Sets the image description.
204      * <p>
205      * @param description the image description to set, <b>null</b> if none.
206      *
207      */
208     public void setDescription(String description) {
209         _description = description;
210     }
211 
212 }