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 mailing address. Mailing address formats vary widely so
22 * no validation is performed.
25 public final class PostalAddress
implements Serializable
, Comparable
<PostalAddress
> {
27 public static final long serialVersionUID
= -1090628591187239495L;
29 private String address
;
31 public PostalAddress(String address
) {
32 if (address
== null) {
33 throw new NullPointerException("address must not be null");
35 this.address
= address
;
39 * This constructor exists for frameworks (e.g. Google Web Toolkit)
40 * that require it for serialization purposes. It should not be
43 @SuppressWarnings("unused")
44 private PostalAddress() {
48 public String
getAddress() {
53 public boolean equals(Object o
) {
57 if (o
== null || getClass() != o
.getClass()) {
61 PostalAddress that
= (PostalAddress
) o
;
63 if (!address
.equals(that
.address
)) {
71 public int hashCode() {
72 return address
.hashCode();
76 public int compareTo(PostalAddress o
) {
77 return address
.compareTo(o
.address
);