001: /*
002: * Copyright 2004 Sun Microsystems, Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: *
016: */
017: package com.sun.syndication.feed.atom;
018:
019: import com.sun.syndication.feed.impl.ObjectBean;
020:
021: import java.io.Serializable;
022:
023: /**
024: * Bean for person elements of Atom feeds.
025: * <p>
026: * @author Alejandro Abdelnur
027: * @author Dave Johnson (updated for Atom 1.0)
028: */
029: public class Person implements Cloneable, Serializable {
030:
031: private ObjectBean _objBean;
032:
033: private String _name;
034: private String _uri; // since Atom 1.0 (was called url)
035: private String _email;
036:
037: /**
038: * Default constructor. All properties are set to <b>null</b>.
039: * <p>
040: *
041: */
042: public Person() {
043: _objBean = new ObjectBean(this .getClass(), this );
044: }
045:
046: /**
047: * Creates a deep 'bean' clone of the object.
048: * <p>
049: * @return a clone of the object.
050: * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
051: *
052: */
053: public Object clone() throws CloneNotSupportedException {
054: return _objBean.clone();
055: }
056:
057: /**
058: * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
059: * <p>
060: * @param other he reference object with which to compare.
061: * @return <b>true</b> if 'this' object is equal to the 'other' object.
062: *
063: */
064: public boolean equals(Object other) {
065: return _objBean.equals(other);
066: }
067:
068: /**
069: * Returns a hashcode value for the object.
070: * <p>
071: * It follows the contract defined by the Object hashCode() method.
072: * <p>
073: * @return the hashcode of the bean object.
074: *
075: */
076: public int hashCode() {
077: return _objBean.hashCode();
078: }
079:
080: /**
081: * Returns the String representation for the object.
082: * <p>
083: * @return String representation for the object.
084: *
085: */
086: public String toString() {
087: return _objBean.toString();
088: }
089:
090: /**
091: * Returns the person name.
092: * <p>
093: * @return the person name, <b>null</b> if none.
094: *
095: */
096: public String getName() {
097: return _name;
098: }
099:
100: /**
101: * Sets the personname.
102: * <p>
103: * @param name the person name, <b>null</b> if none.
104: *
105: */
106: public void setName(String name) {
107: _name = name;
108: }
109:
110: /**
111: * Returns the person URL (same as {@link getUri()})
112: * <p>
113: * @return the person URL, <b>null</b> if none.
114: */
115: public String getUrl() {
116: return _uri;
117: }
118:
119: /**
120: * Sets the person URL (same as {@link setUri()})
121: * <p>
122: * @param url the person URL, <b>null</b> if none.
123: */
124: public void setUrl(String url) {
125: _uri = url;
126: }
127:
128: /**
129: * Returns the person email.
130: * <p>
131: * @return the person email, <b>null</b> if none.
132: *
133: */
134: public String getEmail() {
135: return _email;
136: }
137:
138: /**
139: * Sets the person email.
140: * <p>
141: * @param email the person email, <b>null</b> if none.
142: *
143: */
144: public void setEmail(String email) {
145: _email = email;
146: }
147:
148: /**
149: * Returns the uri
150: * <p>
151: * @return Returns the uri.
152: * @since Atom 1.0
153: */
154: public String getUri() {
155: return _uri;
156: }
157:
158: /**
159: * Set the uri
160: * <p>
161: * @param uri The uri to set.
162: * @since Atom 1.0
163: */
164: public void setUri(String uri) {
165: _uri = uri;
166: }
167: }
|