2 * Copyright 2008 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 {@code Link} is a URL of limited length.
23 * In addition to adding the meaning of {@code URL} onto a String, a {@code Link}
24 * can also be longer than a Text value, with a limit of 2083 characters.
27 public final class Link
implements Serializable
, Comparable
<Link
> {
29 public static final long serialVersionUID
= 731239796613544443L;
34 * This constructor exists for frameworks (e.g. Google Web Toolkit)
35 * that require it for serialization purposes. It should not be
38 @SuppressWarnings("unused")
44 * Constructs a new {@code Link} object with the specified value.
45 * This object cannot be modified after construction.
47 public Link(String value
) {
52 * Returns the value of this {@code Link}.
54 public String
getValue() {
59 public int hashCode() {
60 return value
.hashCode();
64 * Two {@code Link} objects are considered equal if their content
65 * strings match exactly.
68 public boolean equals(Object object
) {
69 if (object
instanceof Link
) {
70 Link key
= (Link
) object
;
71 return value
.equals(key
.value
);
77 * Returns the entire text of this {@code Link}.
80 public String
toString() {
85 public int compareTo(Link l
) {
86 return value
.compareTo(l
.value
);