View Javadoc

1   /*
2    * Copyright 1999,2004 The Apache Software Foundation.
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 org.apache.commons.feedparser;
18  
19  
20  /**
21   *
22   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
23   * @version $Id: FeedVersion.java 373614 2006-01-30 22:31:21Z mvdb $
24   */
25  public class FeedVersion {
26  
27      /**
28       * True if this is an Atom feed.
29       */
30      public boolean isAtom;
31  
32      /**
33       * True if this is an RSS feed
34       */
35      public boolean isRSS;
36      
37      /**
38       * True when this is a Friend of a Friend FOAF file.
39       */
40      public boolean isFOAF;
41  
42      public boolean isOPML;
43  
44      public boolean isXFN;
45  
46      /**
47       * True if this is a changes.xml file.
48       */
49      public boolean isChanges;
50  
51      /**
52       * The version of this specification.  If this is RSS 1.0 the version will
53       * be "1.0".  If this is Atom 0.5 the version will be "0.5" (and so
54       * forth). If the version is unknown the value is simply null.  The format
55       * of this is unstructured text and in many situations is mirrored right
56       * form the 'version' attribute in some RSS/Atom specifications.  See
57       * version_major, version_minor, and version_sub for more info.
58       *
59       * 
60       */
61      public String version = null;
62  
63      public int version_major = 0;
64      public int version_minor = 0;
65      public int version_sub = 0;
66  
67      public String toString() {
68  
69          String result = "";
70  
71          if ( isAtom ) 
72              result = "atom"; 
73          else if ( isRSS )
74              result = "rss";
75          else if ( isFOAF )
76              result = "foaf";
77          else if ( isOPML )
78              result = "opml";
79          else if ( isXFN )
80              result = "xfn";
81          else if ( isChanges )
82              result = "changes";
83  
84          return result += ":" + version;
85  
86      }
87      
88  }