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.atom;
18  
19  import com.sun.syndication.feed.impl.ObjectBean;
20  
21  import java.io.Serializable;
22  
23  /**
24   * Bean for category elements of Atom feeds.
25   * <p>
26   * @author Dave Johnson (added for Atom 1.0)
27   */
28  public class Category implements Cloneable, Serializable  {
29      
30      private ObjectBean _objBean;
31      
32      private String _term;
33      private String _scheme;  
34      private String _label;
35  
36      /**
37       * Default constructor. All properties are set to <b>null</b>.
38       * <p>
39       *
40       */
41      public Category() {
42          _objBean = new ObjectBean(this.getClass(),this);
43      }
44  
45      /**
46       * Creates a deep 'bean' clone of the object.
47       * <p>
48       * @return a clone of the object.
49       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
50       *
51       */
52      public Object clone() throws CloneNotSupportedException {
53          return _objBean.clone();
54      }
55  
56      /**
57       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
58       * <p>
59       * @param other he reference object with which to compare.
60       * @return <b>true</b> if 'this' object is equal to the 'other' object.
61       *
62       */
63      public boolean equals(Object other) {
64          return _objBean.equals(other);
65      }
66  
67      /**
68       * Returns a hashcode value for the object.
69       * <p>
70       * It follows the contract defined by the Object hashCode() method.
71       * <p>
72       * @return the hashcode of the bean object.
73       *
74       */
75      public int hashCode() {
76          return _objBean.hashCode();
77      }
78  
79      /**
80       * Returns the String representation for the object.
81       * <p>
82       * @return String representation for the object.
83       *
84       */
85      public String toString() {
86          return _objBean.toString();
87      }
88      
89      /** 
90       * Get label for category.
91       * <p>
92       * @return Label for category.
93       */
94      public String getLabel() {
95          return _label;
96      }
97      
98      /**
99       * Set label for category.
100      * <p>
101      * @param Label for category.
102      */
103     public void setLabel(String label) {
104         this._label = label;
105     }
106     
107     /**
108      * Get Scheme URI for category.
109      * <p>
110      * @return Scheme URI for category.
111      */
112     public String getScheme() {
113         return _scheme;
114     }
115     
116     /**
117      * Set scheme URI for category.
118      * <p>
119      * @param Scheme URI for category.
120      */
121     public void setScheme(String scheme) {
122         this._scheme = scheme;
123     }
124     
125     /**
126      * Return term for category.
127      * <p>
128      * @return Term for category.
129      */
130     public String getTerm() {
131         return _term;
132     }
133     
134     /**
135      * Set term for category.
136      * <p>
137      * @param Term for category.
138      */
139     public void setTerm(String term) {
140         this._term = term;
141     }
142 }