View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
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  package org.apache.juddi.datatype;
17  
18  
19  /***
20   * Holds email address, can be adorned with an optinal useType attribute. If more than
21   * one Email element is saved within the same contact then the useType must be supplied.
22   *
23   * The useType attribute is used to describe the type of the email address in freeform text.
24   * Examples are "technical questions", "sales contact", etc.
25   *
26   * @author Steve Viens (sviens@apache.org)
27   */
28  public class Email implements RegistryObject
29  {
30    String value;
31    String useType;
32  
33    /***
34     * Construct a new initialized Email instance.
35     */
36    public Email()
37    {
38    }
39  
40    /***
41     * Construct a new Email with a given address.
42     *
43     * @param email The address of the email.
44     */
45    public Email(String email)
46    {
47      this.value = email;
48    }
49  
50    /***
51     * Construct a new Email with a given address and given usetype.
52     *
53     * @param email The address of the email.
54     * @param type The usetype of the email.
55     */
56    public Email(String email, String type)
57    {
58      this.value = email;
59      this.useType = type;
60    }
61  
62    /***
63     * Sets the emailAddress of the Email to the given address.
64     *
65     * @param email The new address of this email.
66     */
67    public void setValue(String email)
68    {
69      this.value = email;
70    }
71  
72    /***
73     * Returns the emailAddress of this Email.
74     *
75     * @return The emailAddress of this Email.
76     */
77    public String getValue()
78    {
79      return this.value;
80    }
81  
82    /***
83     * Sets the usetype of this Email to the given usetype. If the new usetype is
84     * null, this Email doesn't have a usetype anymore.
85     *
86     * @param type The new usetype of this Email, or null if this Email doesn't
87     *  have an usetype anymore.
88     */
89    public void setUseType(String type)
90    {
91      this.useType = type;
92    }
93  
94    /***
95     * Returns the usetype of this Email.
96     *
97     * @return The usetype of this Email, or null if this Email doesn't have
98     *  an usetype.
99     */
100   public String getUseType()
101   {
102     return this.useType;
103   }
104 }