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.module;
18  
19  import com.sun.syndication.feed.synd.impl.SyndCopyFrom;
20  
21  import java.util.*;
22  
23  /***
24   * Dublin Core Module, default implementation.
25   * <p>
26   * @see <a href="http://web.resource.org/rss/1.0/modules/dc/">Dublin Core module</a>.
27   * @author Alejandro Abdelnur
28   *
29   */
30  public class DCModule extends Module implements DCModuleI {
31      private String _title;
32      private String _creator;
33      private List _subjects;
34      private String _description;
35      private String _publisher;
36      private List _contributors;
37      private Date _date;
38      private String type;
39      private String _format;
40      private String _identifier;
41      private String _source;
42      private String _language;
43      private String _relation;
44      private String _coverage;
45      private String _rights;
46  
47      /***
48       * Default constructor. All properties are set to <b>null</b>.
49       * <p>
50       *
51       */
52      public DCModule() {
53          super(DCModuleI.class,URI);
54      }
55  
56      /***
57       * Returns the DublinCore module title.
58       * <p>
59       * @return the DublinCore module title, <b>null</b> if none.
60       *
61       */
62      public String getTitle() {
63          return _title;
64      }
65  
66      /***
67       * Sets the DublinCore module title.
68       * <p>
69       * @param title the DublinCore module title to set, <b>null</b> if none.
70       *
71       */
72      public void setTitle(String title) {
73          _title = title;
74      }
75  
76      /***
77       * Returns the DublinCore module creator.
78       * <p>
79       * @return the DublinCore module creator, <b>null</b> if none.
80       *
81       */
82      public String getCreator() {
83          return _creator;
84      }
85  
86      /***
87       * Sets the DublinCore module creator.
88       * <p>
89       * @param creator the DublinCore module creator to set, <b>null</b> if none.
90       *
91       */
92      public void setCreator(String creator) {
93          _creator = creator;
94      }
95  
96      /***
97       * Returns the DublinCore module subjects.
98       * <p>
99       * @return a list of DCSubjectI elements with the DublinCore module subjects,
100      *         an empty list if none.
101      *
102      */
103     public List getSubjects() {
104         return (_subjects==null) ? (_subjects=new ArrayList()) : _subjects;
105     }
106 
107     /***
108      * Sets the DublinCore module subjects.
109      * <p>
110      * @param subjects the list of DCSubjectI elements with the DublinCore module subjects to set,
111      *        an empty list or <b>null</b> if none.
112      *
113      */
114     public void setSubjects(List subjects) {
115         _subjects = subjects;
116     }
117 
118     /***
119      * Returns the DublinCore module description.
120      * <p>
121      * @return the DublinCore module description, <b>null</b> if none.
122      *
123      */
124     public String getDescription() {
125         return _description;
126     }
127 
128     /***
129      * Sets the DublinCore module description.
130      * <p>
131      * @param description the DublinCore module description to set, <b>null</b> if none.
132      *
133      */
134     public void setDescription(String description) {
135         _description = description;
136     }
137 
138     /***
139      * Returns the DublinCore module publisher.
140      * <p>
141      * @return the DublinCore module publisher, <b>null</b> if none.
142      *
143      */
144     public String getPublisher() {
145         return _publisher;
146     }
147 
148     /***
149      * Sets the DublinCore module publisher.
150      * <p>
151      * @param publisher the DublinCore module publisher to set, <b>null</b> if none.
152      *
153      */
154     public void setPublisher(String publisher) {
155         _publisher = publisher;
156     }
157 
158     /***
159      * Returns the DublinCore module contributors.
160      * <p>
161      * @return a list of String elements with the DublinCore module contributors,
162      *         an empty list if none.
163      *
164      */
165     public List getContributors() {
166         return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
167     }
168 
169     /***
170      * Sets the DublinCore module contributors.
171      * <p>
172      * @param contributors the list of String elements with the DublinCore module contributors to set,
173      *        an empty list or <b>null</b> if none.
174      *
175      */
176     public void setContributors(List contributors) {
177         _contributors = contributors;
178     }
179 
180     /***
181      * Returns the DublinCore module date.
182      * <p>
183      * @return the DublinCore module date, <b>null</b> if none.
184      *
185      */
186     public Date getDate() {
187         return _date;
188     }
189 
190     /***
191      * Sets the DublinCore module date.
192      * <p>
193      * @param date the DublinCore module date to set, <b>null</b> if none.
194      *
195      */
196     public void setDate(Date date) {
197         _date = date;
198     }
199 
200     /***
201      * Returns the DublinCore module type.
202      * <p>
203      * @return the DublinCore module type, <b>null</b> if none.
204      *
205      */
206     public String getType() {
207         return type;
208     }
209 
210     /***
211      * Sets the DublinCore module type.
212      * <p>
213      * @param type the DublinCore module type to set, <b>null</b> if none.
214      *
215      */
216     public void setType(String type) {
217         this.type = type;
218     }
219 
220     /***
221      * Returns the DublinCore module format.
222      * <p>
223      * @return the DublinCore module format, <b>null</b> if none.
224      *
225      */
226     public String getFormat() {
227         return _format;
228     }
229 
230     /***
231      * Sets the DublinCore module format.
232      * <p>
233      * @param format the DublinCore module format to set, <b>null</b> if none.
234      *
235      */
236     public void setFormat(String format) {
237         _format = format;
238     }
239 
240     /***
241      * Returns the DublinCore module identifier.
242      * <p>
243      * @return the DublinCore module identifier, <b>null</b> if none.
244      *
245      */
246     public String getIdentifier() {
247         return _identifier;
248     }
249 
250     /***
251      * Sets the DublinCore module identifier.
252      * <p>
253      * @param identifier the DublinCore module identifier to set, <b>null</b> if none.
254      *
255      */
256     public void setIdentifier(String identifier) {
257         _identifier = identifier;
258     }
259 
260     /***
261      * Returns the DublinCore module source.
262      * <p>
263      * @return the DublinCore module source, <b>null</b> if none.
264      *
265      */
266     public String getSource() {
267         return _source;
268     }
269 
270     /***
271      * Sets the DublinCore module source.
272      * <p>
273      * @param source the DublinCore module source to set, <b>null</b> if none.
274      *
275      */
276     public void setSource(String source) {
277         _source = source;
278     }
279 
280     /***
281      * Returns the DublinCore module language.
282      * <p>
283      * @return the DublinCore module language, <b>null</b> if none.
284      *
285      */
286     public String getLanguage() {
287         return _language;
288     }
289 
290     /***
291      * Sets the DublinCore module language.
292      * <p>
293      * @param language the DublinCore module language to set, <b>null</b> if none.
294      *
295      */
296     public void setLanguage(String language) {
297         _language = language;
298     }
299 
300     /***
301      * Returns the DublinCore module relation.
302      * <p>
303      * @return the DublinCore module relation, <b>null</b> if none.
304      *
305      */
306     public String getRelation() {
307         return _relation;
308     }
309 
310     /***
311      * Sets the DublinCore module relation.
312      * <p>
313      * @param relation the DublinCore module relation to set, <b>null</b> if none.
314      *
315      */
316     public void setRelation(String relation) {
317         _relation = relation;
318     }
319 
320     /***
321      * Returns the DublinCore module coverage.
322      * <p>
323      * @return the DublinCore module coverage, <b>null</b> if none.
324      *
325      */
326     public String getCoverage() {
327         return _coverage;
328     }
329 
330     /***
331      * Sets the DublinCore module coverage.
332      * <p>
333      * @param coverage the DublinCore module coverage to set, <b>null</b> if none.
334      *
335      */
336     public void setCoverage(String coverage) {
337         _coverage = coverage;
338     }
339 
340     /***
341      * Returns the DublinCore module rights.
342      * <p>
343      * @return the DublinCore module rights, <b>null</b> if none.
344      *
345      */
346     public String getRights() {
347         return _rights;
348     }
349 
350     /***
351      * Sets the DublinCore module rights.
352      * <p>
353      * @param rights the DublinCore module rights to set, <b>null</b> if none.
354      *
355      */
356     public void setRights(String rights) {
357         _rights = rights;
358     }
359 
360     public Class getInterface() {
361         return DCModuleI.class;
362     }
363 
364     public void copyFrom(Object obj) {
365         SYND_COPY_FROM.copy(this,obj);
366     }
367 
368     private static final SyndCopyFrom SYND_COPY_FROM;
369 
370     static {
371         Map basePropInterfaceMap = new HashMap();
372         basePropInterfaceMap.put("title",String.class);
373         basePropInterfaceMap.put("creator",String.class);
374         basePropInterfaceMap.put("subjects",DCSubjectI.class);
375         basePropInterfaceMap.put("description",String.class);
376         basePropInterfaceMap.put("publisher",String.class);
377         basePropInterfaceMap.put("contributors",String.class);
378         basePropInterfaceMap.put("date",Date.class);
379         basePropInterfaceMap.put("type",String.class);
380         basePropInterfaceMap.put("format",String.class);
381         basePropInterfaceMap.put("identifier",String.class);
382         basePropInterfaceMap.put("source",String.class);
383         basePropInterfaceMap.put("language",String.class);
384         basePropInterfaceMap.put("relation",String.class);
385         basePropInterfaceMap.put("coverage",String.class);
386         basePropInterfaceMap.put("rights",String.class);
387 
388         Map basePropClassImplMap = new HashMap();
389         basePropClassImplMap.put(DCSubjectI.class,DCSubject.class);
390 
391         SYND_COPY_FROM = new SyndCopyFrom(DCModuleI.class,basePropInterfaceMap,basePropClassImplMap);
392     }
393 
394 }