01: /*
02: * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights
03: * Reserved. Use is subject to license terms.
04: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License version
08: * 2 only, as published by the Free Software Foundation.
09: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * General Public License version 2 for more details (a copy is
14: * included at /legal/license.txt).
15: *
16: * You should have received a copy of the GNU General Public License
17: * version 2 along with this work; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22: * Clara, CA 95054 or visit www.sun.com if you need additional
23: * information or have any questions.
24: */
25: /*
26: */
27: package gov.nist.javax.sdp.fields;
28:
29: import gov.nist.core.*;
30:
31: /**
32: * Email address record.
33: *
34: *
35: * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
36: */
37: public class Email extends SDPObject {
38: /** User name. */
39: protected String userName;
40: /** Host name. */
41: protected String hostName;
42:
43: /**
44: * Gets the user name.
45: * @return the user name
46: */
47: public String getUserName() {
48: return userName;
49: }
50:
51: /**
52: * Gets the host name.
53: * @return host name
54: */
55: public String getHostName() {
56: return hostName;
57: }
58:
59: /**
60: * Copies the current instance.
61: * @return the copy of this object
62: */
63: public Object clone() {
64: Email retval = new Email();
65: retval.userName = userName;
66: retval.hostName = hostName;
67: return retval;
68: }
69:
70: /**
71: * Sets the user name member.
72: * @param u the new user name
73: */
74: public void setUserName(String u) {
75: userName = u;
76: }
77:
78: /**
79: * Sets the host name member.
80: * @param h the new host name
81: */
82: public void setHostName(String h) {
83: hostName = h.trim();
84: }
85:
86: /**
87: * Gest the string encoded version of this object.
88: * @return the encode string of this objects contents
89: * @since v1.0
90: */
91: public String encode() {
92: return userName + Separators.AT + hostName;
93: }
94:
95: }
|