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