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.common.ObjectBean;
20  
21  import java.util.ArrayList;
22  import java.util.Date;
23  import java.util.List;
24  
25  /***
26   * Bean for items of RSS feeds.
27   * <p>
28   * It handles all RSS versions without loosing information.
29   * <p>
30   * For RSS1.0 it supports Dublin Core and Syndication modules. Note that
31   * those modules currently support simple syntax format only.
32   * <p>
33   * @author Alejandro Abdelnur
34   *
35   */
36  public class Item extends ObjectBean {
37      private String _title;
38      private String _link;
39      private Description _description;
40      private Source _source;
41      private List _enclosures;
42      private List _categories;
43      private Guid _guid;
44      private String _comments;
45      private String _author;
46      private Date _pubDate;
47      private Date _expirationDate;
48      private List _modules;
49  
50      /***
51       * Default constructor. All properties are set to <b>null</b>.
52       * <p>
53       *
54       */
55      public Item() {
56      }
57  
58      /***
59       * Returns the item title.
60       * <p>
61       * @return the item title, <b>null</b> if none.
62       *
63       */
64      public String getTitle() {
65          return _title;
66      }
67  
68      /***
69       * Sets the item title.
70       * <p>
71       * @param title the item title to set, <b>null</b> if none.
72       *
73       */
74      public void setTitle(String title) {
75          _title = title;
76      }
77  
78      /***
79       * Returns the item link.
80       * <p>
81       * @return the item link, <b>null</b> if none.
82       *
83       */
84      public String getLink() {
85          return _link;
86      }
87  
88      /***
89       * Sets the item link.
90       * <p>
91       * @param link the item link to set, <b>null</b> if none.
92       *
93       */
94      public void setLink(String link) {
95          _link = link;
96      }
97  
98      /***
99       * Returns the item description.
100      * <p>
101      * @return the item description, <b>null</b> if none.
102      *
103      */
104     public Description getDescription() {
105         return _description;
106     }
107 
108     /***
109      * Sets the item description.
110      * <p>
111      * @param description the item description to set, <b>null</b> if none.
112      *
113      */
114     public void setDescription(Description description) {
115         _description = description;
116     }
117 
118     /***
119      * Returns the item source.
120      * <p>
121      * @return the item source, <b>null</b> if none.
122      *
123      */
124     public Source getSource() {
125         return _source;
126     }
127 
128     /***
129      * Sets the item source.
130      * <p>
131      * @param source the item source to set, <b>null</b> if none.
132      *
133      */
134     public void setSource(Source source) {
135         _source = source;
136     }
137 
138     /***
139      * Returns the item enclosures.
140      * <p>
141      * @return a list of Enclosure elements with the item enclosures,
142      *         an empty list if none.
143      *
144      */
145     public List getEnclosures() {
146         return (_enclosures==null) ? (_enclosures=new ArrayList()) : _enclosures;
147     }
148 
149     /***
150      * Sets the item enclosures.
151      * <p>
152      * @param enclosures the list of Enclosure elements with the item enclosures to set,
153      *        an empty list or <b>null</b> if none.
154      *
155      */
156     public void setEnclosures(List enclosures) {
157         _enclosures = enclosures;
158     }
159 
160     /***
161      * Returns the item categories.
162      * <p>
163      * @return a list of Category elements with the item categories,
164      *         an empty list if none.
165      *
166      */
167     public List getCategories() {
168         return (_categories==null) ? (_categories=new ArrayList()) : _categories;
169     }
170 
171     /***
172      * Sets the item categories.
173      * <p>
174      * @param categories the list of Categories elements with the item categories to set,
175      *        an empty list or <b>null</b> if none.
176      *
177      */
178     public void setCategories(List categories) {
179         _categories = categories;
180     }
181 
182     /***
183      * Returns the item GUID.
184      * <p>
185      * @return the item GUID, <b>null</b> if none.
186      *
187      */
188     public Guid getGuid() {
189         return _guid;
190     }
191 
192     /***
193      * Sets the item GUID.
194      * <p>
195      * @param guid the item GUID to set, <b>null</b> if none.
196      *
197      */
198     public void setGuid(Guid guid) {
199         _guid = guid;
200     }
201 
202     /***
203      * Returns the item comments.
204      * <p>
205      * @return the item comments, <b>null</b> if none.
206      *
207      */
208     public String getComments() {
209         return _comments;
210     }
211 
212     /***
213      * Sets the item comments.
214      * <p>
215      * @param comments the item comments to set, <b>null</b> if none.
216      *
217      */
218     public void setComments(String comments) {
219         _comments = comments;
220     }
221 
222     /***
223      * Returns the item author.
224      * <p>
225      * @return the item author, <b>null</b> if none.
226      *
227      */
228     public String getAuthor() {
229         return _author;
230     }
231 
232     /***
233      * Sets the item author.
234      * <p>
235      * @param author the item author to set, <b>null</b> if none.
236      *
237      */
238     public void setAuthor(String author) {
239         _author = author;
240     }
241 
242     /***
243      * Returns the item modules.
244      * <p>
245      * @return a list of Module elements with the item modules,
246      *         an empty list if none.
247      *
248      */
249     public List getModules() {
250         return (_modules==null) ? (_modules=new ArrayList()) : _modules;
251     }
252 
253     /***
254      * Sets the item modules.
255      * <p>
256      * @param modules the list of Module elements with the item modules to set,
257      *        an empty list or <b>null</b> if none.
258      *
259      */
260     public void setModules(List modules) {
261         _modules = modules;
262     }
263 
264     /***
265      * Returns the item publishing date.
266      * <p>
267      * @return the item publishing date, <b>null</b> if none.
268      *
269      */
270     public Date getPubDate() {
271         return _pubDate;
272     }
273 
274     /***
275      * Sets the item publishing date.
276      * <p>
277      * @param pubDate the item publishing date to set, <b>null</b> if none.
278      *
279      */
280     public void setPubDate(Date pubDate) {
281         _pubDate = pubDate;
282     }
283 
284     /***
285      * Returns the item expiration date.
286      * <p>
287      * @return the item expiration date, <b>null</b> if none.
288      *
289      */
290     public Date getExpirationDate() {
291         return _expirationDate;
292     }
293 
294     /***
295      * Sets the item expiration date.
296      * <p>
297      * @param expirationDate the item expiration date to set, <b>null</b> if none.
298      *
299      */
300     public void setExpirationDate(Date expirationDate) {
301         _expirationDate = expirationDate;
302     }
303 
304 }