KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > syndication > feed > atom > Entry


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.atom;
18
19 import com.sun.syndication.feed.impl.ObjectBean;
20 import com.sun.syndication.feed.module.Module;
21 import com.sun.syndication.feed.module.impl.ModuleUtils;
22 import com.sun.syndication.feed.impl.ObjectBean;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Date JavaDoc;
26 import java.util.List JavaDoc;
27 import java.io.Serializable JavaDoc;
28
29 /**
30  * Bean for entry elements of Atom feeds.
31  * <p>
32  * @author Alejandro Abdelnur
33  *
34  */

35 public class Entry implements Cloneable JavaDoc,Serializable JavaDoc {
36     private ObjectBean _objBean;
37     private String JavaDoc _title;
38     private List JavaDoc _alternateLinks;
39     private List JavaDoc _otherLinks;
40     private Person _author;
41     private List JavaDoc _contributors;
42     private String JavaDoc _id;
43     private Date JavaDoc _modified;
44     private Date JavaDoc _issued;
45     private Date JavaDoc _created;
46     private Content _summary;
47     private List JavaDoc _contents;
48     private List JavaDoc _modules;
49
50     /**
51      * Default constructor. All properties are set to <b>null</b>.
52      * <p>
53      *
54      */

55     public Entry() {
56         _objBean = new ObjectBean(this.getClass(),this);
57     }
58
59     /**
60      * Creates a deep 'bean' clone of the object.
61      * <p>
62      * @return a clone of the object.
63      * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
64      *
65      */

66     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
67         return _objBean.clone();
68     }
69
70     /**
71      * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
72      * <p>
73      * @param other he reference object with which to compare.
74      * @return <b>true</b> if 'this' object is equal to the 'other' object.
75      *
76      */

77     public boolean equals(Object JavaDoc other) {
78         return _objBean.equals(other);
79     }
80
81     /**
82      * Returns a hashcode value for the object.
83      * <p>
84      * It follows the contract defined by the Object hashCode() method.
85      * <p>
86      * @return the hashcode of the bean object.
87      *
88      */

89     public int hashCode() {
90         return _objBean.hashCode();
91     }
92
93     /**
94      * Returns the String representation for the object.
95      * <p>
96      * @return String representation for the object.
97      *
98      */

99     public String JavaDoc toString() {
100         return _objBean.toString();
101     }
102
103     /**
104      * Returns the entry title.
105      * <p>
106      * @return the entry title, <b>null</b> if none.
107      *
108      */

109     public String JavaDoc getTitle() {
110         return _title;
111     }
112
113     /**
114      * Sets the entry title.
115      * <p>
116      * @param title the entry title, <b>null</b> if none.
117      *
118      */

119     public void setTitle(String JavaDoc title) {
120         _title = title;
121     }
122
123     /**
124      * Returns the entry alternate links.
125      * <p>
126      * @return a list of Link elements with the entry alternate links, an empty list if none.
127      *
128      */

129     public List JavaDoc getAlternateLinks() {
130         return (_alternateLinks==null) ? (_alternateLinks=new ArrayList JavaDoc()) : _alternateLinks;
131     }
132
133     /**
134      * Sets the entry alternate links.
135      * <p>
136      * @param alternateLinks the list of Link elements with the entry alternate links to set,
137      * an empty list or <b>null</b> if none.
138      *
139      */

140     public void setAlternateLinks(List JavaDoc alternateLinks) {
141         _alternateLinks = alternateLinks;
142     }
143
144     /**
145      * Returns the entry non-alternate links.
146      * <p>
147      * @return the list of Link elements with the entry non-alternate links to set,
148      * an empty list if none.
149      *
150      */

151     public List JavaDoc getOtherLinks() {
152         return (_otherLinks==null) ? (_otherLinks=new ArrayList JavaDoc()) : _otherLinks;
153     }
154
155     /**
156      * Sets the entry non-alternate links.
157      * <p>
158      * @param otherLinks the list Link elements with the entry non-alternate links to set,
159      * an empty list or <b>null</b> if none.
160      *
161      */

162     public void setOtherLinks(List JavaDoc otherLinks) {
163         _otherLinks = otherLinks;
164     }
165
166     /**
167      * Returns the entry author.
168      * <p>
169      * @return the entry author, <b>null</b> if none.
170      *
171      */

172     public Person getAuthor() {
173         return _author;
174     }
175
176     /**
177      * Sets the author of the entry.
178      * <p>
179      * @param author the author of the entry, <b>null</b> if none.
180      *
181      */

182     public void setAuthor(Person author) {
183         _author = author;
184     }
185
186     /**
187      * Returns the entry contributors.
188      * <p>
189      * @return a list of Person elements with the entry contributors,
190      * an empty list if none.
191      *
192      */

193     public List JavaDoc getContributors() {
194         return (_contributors==null) ? (_contributors=new ArrayList JavaDoc()) : _contributors;
195     }
196
197     /**
198      * Sets the entry contributors.
199      * <p>
200      * @param contributors the list of Person elements with the entry contributors to set,
201      * an empty list or <b>null</b> if none.
202      *
203      */

204     public void setContributors(List JavaDoc contributors) {
205         _contributors = contributors;
206     }
207
208     /**
209      * Returns the entry ID.
210      * <p>
211      * @return the entry ID, <b>null</b> if none.
212      *
213      */

214     public String JavaDoc getId() {
215         return _id;
216     }
217
218     /**
219      * Sets the entry ID.
220      * <p>
221      * @param id the entry ID, <b>null</b> if none.
222      *
223      */

224     public void setId(String JavaDoc id) {
225         _id = id;
226     }
227
228     /**
229      * Returns the entry modified date.
230      * <p>
231      * @return the entry modified date, <b>null</b> if none.
232      *
233      */

234     public Date JavaDoc getModified() {
235         return _modified;
236     }
237
238     /**
239      * Sets the entry modified date.
240      * <p>
241      * @param modified the entry modified date, <b>null</b> if none.
242      *
243      */

244     public void setModified(Date JavaDoc modified) {
245         _modified = modified;
246     }
247
248     /**
249      * Returns the entry issued date.
250      * <p>
251      * @return the entry issued date, <b>null</b> if none.
252      *
253      */

254     public Date JavaDoc getIssued() {
255         return _issued;
256     }
257
258     /**
259      * Sets the entry issued date.
260      * <p>
261      * @param issued the entry issued date, <b>null</b> if none.
262      *
263      */

264     public void setIssued(Date JavaDoc issued) {
265         _issued = issued;
266     }
267
268     /**
269      * Returns the entry created date.
270      * <p>
271      * @return the entry created date, <b>null</b> if none.
272      *
273      */

274     public Date JavaDoc getCreated() {
275         return _created;
276     }
277
278     /**
279      * Sets the entry created date.
280      * <p>
281      * @param created the entry created date, <b>null</b> if none.
282      *
283      */

284     public void setCreated(Date JavaDoc created) {
285         _created = created;
286     }
287
288     /**
289      * Returns the entry summary.
290      * <p>
291      * @return the entry summary, <b>null</b> if none.
292      *
293      */

294     public Content getSummary() {
295         return _summary;
296     }
297
298     /**
299      * Sets the entry summary.
300      * <p>
301      * @param summary the entry summary, <b>null</b> if none.
302      *
303      */

304     public void setSummary(Content summary) {
305         _summary = summary;
306     }
307
308     /**
309      * Returns the entry contents.
310      * <p>
311      * @return a list of Content elements with the entry contents,
312      * an empty list if none.
313      *
314      */

315     public List JavaDoc getContents() {
316         return (_contents==null) ? (_contents=new ArrayList JavaDoc()) : _contents;
317     }
318
319     /**
320      * Sets the entry contents.
321      * <p>
322      * @param contents the list of Content elements with the entry contents to set,
323      * an empty list or <b>null</b> if none.
324      *
325      */

326     public void setContents(List JavaDoc contents) {
327         _contents = contents;
328     }
329
330     /**
331      * Returns the entry modules.
332      * <p>
333      * @return a list of ModuleImpl elements with the entry modules,
334      * an emtpy list if none.
335      *
336      */

337     public List JavaDoc getModules() {
338         return (_modules==null) ? (_modules=new ArrayList JavaDoc()) : _modules;
339     }
340
341     /**
342      * Sets the entry modules.
343      * <p>
344      * @param modules the list of ModuleImpl elements with the entry modules to set,
345      * an empty list or <b>null</b> if none.
346      *
347      */

348     public void setModules(List JavaDoc modules) {
349         _modules = modules;
350     }
351
352     /**
353      * Returns the module identified by a given URI.
354      * <p>
355      * @param uri the URI of the ModuleImpl.
356      * @return The module with the given URI, <b>null</b> if none.
357      */

358     public Module getModule(String JavaDoc uri) {
359         return ModuleUtils.getModule(_modules,uri);
360     }
361
362 }
363
Popular Tags