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 _schemeResolved;  
35      private String _label;
36  
37      /***
38       * Default constructor. All properties are set to <b>null</b>.
39       * <p>
40       *
41       */
42      public Category() {
43          _objBean = new ObjectBean(this.getClass(),this);
44      }
45  
46      /***
47       * Creates a deep 'bean' clone of the object.
48       * <p>
49       * @return a clone of the object.
50       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
51       *
52       */
53      public Object clone() throws CloneNotSupportedException {
54          return _objBean.clone();
55      }
56  
57      /***
58       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
59       * <p>
60       * @param other he reference object with which to compare.
61       * @return <b>true</b> if 'this' object is equal to the 'other' object.
62       *
63       */
64      public boolean equals(Object other) {
65          return _objBean.equals(other);
66      }
67  
68      /***
69       * Returns a hashcode value for the object.
70       * <p>
71       * It follows the contract defined by the Object hashCode() method.
72       * <p>
73       * @return the hashcode of the bean object.
74       *
75       */
76      public int hashCode() {
77          return _objBean.hashCode();
78      }
79  
80      /***
81       * Returns the String representation for the object.
82       * <p>
83       * @return String representation for the object.
84       *
85       */
86      public String toString() {
87          return _objBean.toString();
88      }
89      
90      /*** 
91       * Get label for category.
92       * <p>
93       * @return Label for category.
94       */
95      public String getLabel() {
96          return _label;
97      }
98      
99      /***
100      * Set label for category.
101      * <p>
102      * @param Label for category.
103      */
104     public void setLabel(String label) {
105         this._label = label;
106     }
107     
108     /***
109      * Get Scheme URI for category.
110      * <p>
111      * @return Scheme URI for category.
112      */
113     public String getScheme() {
114         return _scheme;
115     }
116     
117     /***
118      * Set scheme URI for category.
119      * <p>
120      * @param Scheme URI for category.
121      */
122     public void setScheme(String scheme) {
123         this._scheme = scheme;
124     }
125     
126     public void setSchemeResolved(String schemeResolved) {
127         _schemeResolved = schemeResolved;
128     }
129 
130     public String getSchemeResolved() {
131         return _schemeResolved != null ? _schemeResolved : _scheme;
132     }
133 
134     /***
135      * Return term for category.
136      * <p>
137      * @return Term for category.
138      */
139     public String getTerm() {
140         return _term;
141     }
142     
143     /***
144      * Set term for category.
145      * <p>
146      * @param Term for category.
147      */
148     public void setTerm(String term) {
149         this._term = term;
150     }
151 }