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.synd;
18  
19  import com.sun.syndication.feed.impl.ObjectBean;
20  import com.sun.syndication.feed.module.DCSubjectImpl;
21  import com.sun.syndication.feed.module.DCSubject;
22  
23  import java.util.AbstractList;
24  import java.util.List;
25  import java.util.ArrayList;
26  import java.io.Serializable;
27  
28  /***
29   * Bean for authors and contributors of SyndFeedImpl feeds and entries.
30   * <p>
31   * @author Dave Johnson
32   *
33   */
34  public class SyndPersonImpl implements Serializable, SyndPerson {
35      private ObjectBean _objBean;
36      private String _name;
37      private String _uri;
38      private String _email;
39  
40      /***
41       * For implementations extending SyndContentImpl to be able to use the ObjectBean functionality
42       * with extended interfaces.
43       */
44      public SyndPersonImpl() {
45          _objBean = new ObjectBean(SyndPerson.class,this);
46      }
47  
48      /***
49       * Creates a deep 'bean' clone of the object.
50       * <p>
51       * @return a clone of the object.
52       * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
53       *
54       */
55      public Object clone() throws CloneNotSupportedException {
56          return _objBean.clone();
57      }
58  
59      /***
60       * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
61       * <p>
62       * @param other he reference object with which to compare.
63       * @return <b>true</b> if 'this' object is equal to the 'other' object.
64       *
65       */
66      public boolean equals(Object other) {
67          return _objBean.equals(other);
68      }
69  
70      /***
71       * Returns a hashcode value for the object.
72       * <p>
73       * It follows the contract defined by the Object hashCode() method.
74       * <p>
75       * @return the hashcode of the bean object.
76       *
77       */
78      public int hashCode() {
79          return _objBean.hashCode();
80      }
81  
82      /***
83       * Returns the String representation for the object.
84       * <p>
85       * @return String representation for the object.
86       *
87       */
88      public String toString() {
89          return _objBean.toString();
90      }
91  
92      /***
93       * Returns the person name.
94       * <p>
95       * @return the person name, <b>null</b> if none.
96       *
97       */
98      public String getName() {
99          return _name;
100     }
101 
102     /***
103      * Sets the category name.
104      * <p>
105      * @param name the category name to set, <b>null</b> if none.
106      *
107      */
108     public void setName(String name) {
109         _name = name;
110     }
111 
112     /***
113      * Returns the person's e-mail address.
114      * <p>
115      * @return the person's e-mail address, <b>null</b> if none.
116      *
117      */
118     public String getEmail() {
119         return _email;
120     }
121 
122     /***
123      * Sets the person's e-mail address.
124      * <p>
125      * @param email The person's e-mail address to set, <b>null</b> if none.
126      *
127      */
128     public void setEmail(String email) {
129         _email = email;
130     }
131     
132     /***
133      * Returns the person's URI.
134      * <p>
135      * @return the person's URI, <b>null</b> if none.
136      *
137      */
138     public String getUri() {
139         return _uri;
140     }
141 
142     /***
143      * Sets the person's URI.
144      * <p>
145      * @param uri the peron's URI to set, <b>null</b> if none.
146      *
147      */
148     public void setUri(String uri) {
149         _uri = uri;
150     }
151 }