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.ObjectBean;
20  import com.sun.syndication.feed.impl.CopyFromHelper;
21  import com.sun.syndication.feed.impl.ObjectBean;
22  
23  import java.util.Collections;
24  import java.util.HashMap;
25  import java.util.Map;
26  import java.io.Serializable;
27  
28  /***
29   * Subject of the Dublin Core ModuleImpl, default implementation.
30   * <p>
31   * @see <a href="http://web.resource.org/rss/1.0/modules/dc/">Dublin Core module</a>.
32   * @author Alejandro Abdelnur
33   *
34   */
35  public class DCSubjectImpl implements Cloneable,Serializable, DCSubject {
36      private ObjectBean _objBean;
37      private String _taxonomyUri;
38      private String _value;
39  
40      /***
41       * Default constructor. All properties are set to <b>null</b>.
42       * <p>
43       *
44       */
45      public DCSubjectImpl() {
46          _objBean = new ObjectBean(this.getClass(),this);
47      }
48  
49      /***
50       * Creates a deep 'bean' clone of the object.
51       * <p>
52       * @return a clone of the object.
53       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
54       *
55       */
56      public Object clone() throws CloneNotSupportedException {
57          return _objBean.clone();
58      }
59  
60      /***
61       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
62       * <p>
63       * @param other he reference object with which to compare.
64       * @return <b>true</b> if 'this' object is equal to the 'other' object.
65       *
66       */
67      public boolean equals(Object other) {
68          return _objBean.equals(other);
69      }
70  
71      /***
72       * Returns a hashcode value for the object.
73       * <p>
74       * It follows the contract defined by the Object hashCode() method.
75       * <p>
76       * @return the hashcode of the bean object.
77       *
78       */
79      public int hashCode() {
80          return _objBean.hashCode();
81      }
82  
83      /***
84       * Returns the String representation for the object.
85       * <p>
86       * @return String representation for the object.
87       *
88       */
89      public String toString() {
90          return _objBean.toString();
91      }
92  
93      /***
94       * Returns the DublinCore subject taxonomy URI.
95       * <p>
96       * @return the DublinCore subject taxonomy URI, <b>null</b> if none.
97       *
98       */
99      public String getTaxonomyUri() {
100         return _taxonomyUri;
101     }
102 
103     /***
104      * Sets the DublinCore subject taxonomy URI.
105      * <p>
106      * @param taxonomyUri the DublinCore subject taxonomy URI to set, <b>null</b> if none.
107      *
108      */
109     public void setTaxonomyUri(String taxonomyUri) {
110         _taxonomyUri = taxonomyUri;
111     }
112 
113     /***
114      * Returns the DublinCore subject value.
115      * <p>
116      * @return the DublinCore subject value, <b>null</b> if none.
117      *
118      */
119     public String getValue() {
120         return _value;
121     }
122 
123     /***
124      * Sets the DublinCore subject value.
125      * <p>
126      * @param value the DublinCore subject value to set, <b>null</b> if none.
127      *
128      */
129     public void setValue(String value) {
130         _value = value;
131     }
132 
133     public Class getInterface() {
134         return DCSubject.class;
135     }
136 
137     public void copyFrom(Object obj) {
138         COPY_FROM_HELPER.copy(this,obj);
139     }
140 
141     private static final CopyFromHelper COPY_FROM_HELPER;
142 
143     static {
144         Map basePropInterfaceMap = new HashMap();
145         basePropInterfaceMap.put("taxonomyUri",String.class);
146         basePropInterfaceMap.put("value",String.class);
147 
148         Map basePropClassImplMap = Collections.EMPTY_MAP;
149 
150         COPY_FROM_HELPER = new CopyFromHelper(DCSubject.class,basePropInterfaceMap,basePropClassImplMap);
151     }
152 
153 }