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;
18  
19  import com.sun.syndication.common.ObjectBean;
20  
21  /***
22   * Parent class of the RSS (Channel) and Atom (Feed) feed beans.
23   * <p>
24   * NOTE: We don't like this class at this package level but the alternative would have
25   * been a proliferation of packages (one more level to hold atom and rss package with
26   * this class just in that package).
27   * <p>
28   * The format of the 'type' property must be [FEEDNAME]_[FEEDVERSION] with the FEEDNAME in lower case,
29   * for example: rss_0.9, rss_0.93, atom_0.3
30   * <p>
31   * @author Alejandro Abdelnur
32   *
33   */
34  public abstract class WireFeed extends ObjectBean  {
35      private String _feedType;
36      private String _encoding;
37  
38      /***
39       * Default constructor, for bean cloning purposes only.
40       * <p>
41       * @param beanClass the class/interface to be used for property scanning.
42       */
43      protected WireFeed(Class beanClass) {
44          super(beanClass);
45      }
46  
47      /***
48       * Creates a feed for a given type.
49       * <p>
50       * @param beanClass the class/interface to be used for property scanning.
51       * @param type of the feed to create.
52       *
53       */
54      protected WireFeed(Class beanClass,String type) {
55          this(beanClass);
56          _feedType = type;
57      }
58  
59      /***
60       * Sets the feedType of a the feed. <b>Do not use</b>, for bean cloning purposes only.
61       * <p>
62       * @param feedType the feedType of the feed.
63       *
64       */
65      public void setFeedType(String feedType) {
66          _feedType = feedType;
67      }
68  
69      /***
70       * Returns the type of the feed.
71       *
72       * @return the type of the feed.
73       */
74      public String getFeedType() {
75          return _feedType;
76      }
77  
78      /***
79       * Returns the charset encoding of a the feed. This is not set by Rome parsers.
80       * <p>
81       * @return the charset encoding of the feed.
82       *
83       */
84      public String getEncoding() {
85          return _encoding;
86      }
87  
88      /***
89       * Sets the charset encoding of a the feed. This is not set by Rome parsers.
90       * <p>
91       * @param encoding the charset encoding of the feed.
92       *
93       */
94      public void setEncoding(String encoding) {
95          _encoding = encoding;
96      }
97  
98  }