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 telephone nbrs, can be adorned with an optinal useType attribute. If
21   * more than one Phone element is saved (in a Contacts.Phone[] ) then the
22   * useType must be supplied.
23   *
24   * @author Steve Viens (sviens@apache.org)
25   */
26  public class Phone implements RegistryObject
27  {
28    String phoneNumber;
29    String useType;
30  
31    /***
32     * Construct a new initialized Phone instance.
33     */
34    public Phone()
35    {
36    }
37  
38    /***
39     * Construct a new phone with a given phone-number.
40     *
41     * @param number The number of the new phone.
42     */
43    public Phone(String number)
44    {
45      this.phoneNumber = number;
46    }
47  
48    /***
49     * Construct a new phone with a given phone-number and usetype.
50     *
51     * @param number The number of the new phone.
52     * @param useType The usetype of the new phone.
53     */
54    public Phone(String number, String useType)
55    {
56      this.phoneNumber = number;
57      this.useType = useType;
58    }
59  
60    /***
61     * Sets the number of this Phone to the given number.
62     *
63     * @param number The new number of this phone.
64     */
65    public void setValue(String number)
66    {
67      this.phoneNumber = number;
68    }
69  
70    /***
71     * Returns the number of this Phone.
72     *
73     * @return The number of this Phone.
74     */
75    public String getValue()
76    {
77      return this.phoneNumber;
78    }
79  
80    /***
81     * Sets the UseType of this Phone to the given UseType. If this Phone
82     * doesn't have a UseType anymore, then the new usetype must be null.
83     *
84     * @param type The new UseType of this Phone.
85     */
86    public void setUseType(String type)
87    {
88      this.useType = type;
89    }
90  
91    /***
92     * Returns the UseType of this Phone.
93     *
94     * @return The UseType of this Phone, or null if this Phone doesn't have
95     * an UseType.
96     */
97    public String getUseType()
98    {
99      return this.useType;
100   }
101 }