| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EmailAddressImpl |
|
| 2.3;2.3 |
| 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 | ||
| 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 | { | |
| 31 | private String email; | |
| 32 | private String type; | |
| 33 | ||
| 34 | public EmailAddressImpl() | |
| 35 | 8 | { |
| 36 | 8 | } |
| 37 | ||
| 38 | public EmailAddressImpl(String email) | |
| 39 | 30 | { |
| 40 | 30 | this.email = email; |
| 41 | 30 | } |
| 42 | ||
| 43 | public EmailAddressImpl(String email, String type) | |
| 44 | 68 | { |
| 45 | 68 | this.email = email; |
| 46 | 68 | this.type = type; |
| 47 | 68 | } |
| 48 | ||
| 49 | public String getAddress() throws JAXRException | |
| 50 | { | |
| 51 | 72 | return email; |
| 52 | } | |
| 53 | ||
| 54 | public String getType() throws JAXRException | |
| 55 | { | |
| 56 | 34 | return type; |
| 57 | } | |
| 58 | ||
| 59 | public void setAddress(String str) throws JAXRException | |
| 60 | { | |
| 61 | 2 | this.email = str; |
| 62 | 2 | } |
| 63 | ||
| 64 | public void setType(String str) throws JAXRException | |
| 65 | { | |
| 66 | 2 | this.type = str; |
| 67 | 2 | } |
| 68 | ||
| 69 | public boolean equals(Object o) | |
| 70 | { | |
| 71 | 0 | if (this == o) return true; |
| 72 | 0 | if (!(o instanceof EmailAddressImpl)) return false; |
| 73 | 0 | final EmailAddressImpl emailAddress = (EmailAddressImpl) o; |
| 74 | 0 | if (email != null ? !email.equals(emailAddress.email) : emailAddress.email != null) return false; |
| 75 | 0 | if (type != null ? !type.equals(emailAddress.type) : emailAddress.type != null) return false; |
| 76 | 0 | return true; |
| 77 | } | |
| 78 | ||
| 79 | public int hashCode() | |
| 80 | { | |
| 81 | int result; | |
| 82 | 0 | result = (email != null ? email.hashCode() : 0); |
| 83 | 0 | result = 29 * result + (type != null ? type.hashCode() : 0); |
| 84 | 0 | return result; |
| 85 | } | |
| 86 | ||
| 87 | public String toString() | |
| 88 | { | |
| 89 | 4 | return email == null ? "null" : email; |
| 90 | } | |
| 91 | } |