01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 org.apache.ws.scout.registry.infomodel;
18:
19: import javax.xml.registry.JAXRException;
20: import javax.xml.registry.infomodel.EmailAddress;
21:
22: /**
23: * Implements EmailAddress
24: * * Implements JAXR Interface.
25: * For futher details, look into the JAXR API Javadoc.
26: *
27: * @author Anil Saldhana <anil@apache.org>
28: */
29: public class EmailAddressImpl implements EmailAddress {
30: private String email;
31: private String type;
32:
33: public EmailAddressImpl() {
34: }
35:
36: public EmailAddressImpl(String email) {
37: this .email = email;
38: }
39:
40: public EmailAddressImpl(String email, String type) {
41: this .email = email;
42: this .type = type;
43: }
44:
45: public String getAddress() throws JAXRException {
46: return email;
47: }
48:
49: public String getType() throws JAXRException {
50: return type;
51: }
52:
53: public void setAddress(String str) throws JAXRException {
54: this .email = str;
55: }
56:
57: public void setType(String str) throws JAXRException {
58: this .type = str;
59: }
60:
61: public boolean equals(Object o) {
62: if (this == o)
63: return true;
64: if (!(o instanceof EmailAddressImpl))
65: return false;
66: final EmailAddressImpl emailAddress = (EmailAddressImpl) o;
67: if (email != null ? !email.equals(emailAddress.email)
68: : emailAddress.email != null)
69: return false;
70: if (type != null ? !type.equals(emailAddress.type)
71: : emailAddress.type != null)
72: return false;
73: return true;
74: }
75:
76: public int hashCode() {
77: int result;
78: result = (email != null ? email.hashCode() : 0);
79: result = 29 * result + (type != null ? type.hashCode() : 0);
80: return result;
81: }
82:
83: public String toString() {
84: return email == null ? "null" : email;
85: }
86: }
|