2 * Copyright 2009 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com
.google
.appengine
.api
.datastore
;
18 import java
.io
.Serializable
;
21 * A human-readable phone number. No validation is performed because phone
22 * numbers have many different formats - local, long distance, domestic,
23 * international, internal extension, TTY, VOIP, SMS, and alternative networks
24 * like Skype, XFire and Roger Wilco. They all have their own numbering and
28 public final class PhoneNumber
implements Serializable
, Comparable
<PhoneNumber
> {
30 public static final long serialVersionUID
= -8968032543663409348L;
32 private String number
;
34 public PhoneNumber(String number
) {
36 throw new NullPointerException("number must not be null");
42 * This constructor exists for frameworks (e.g. Google Web Toolkit)
43 * that require it for serialization purposes. It should not be
46 @SuppressWarnings("unused")
47 private PhoneNumber() {
51 public String
getNumber() {
56 public boolean equals(Object o
) {
60 if (o
== null || getClass() != o
.getClass()) {
64 PhoneNumber that
= (PhoneNumber
) o
;
66 if (!number
.equals(that
.number
)) {
74 public int hashCode() {
75 return number
.hashCode();
79 public int compareTo(PhoneNumber o
) {
80 return number
.compareTo(o
.number
);