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 tag, ie a descriptive word or phrase. Entities may be tagged by users,
22 * and later returned by a queries for that tag. Tags can also be used for
23 * ranking results (frequency), photo captions, clustering, activity, etc.
25 * @see <a href="http://www.zeldman.com/daily/0405d.shtml">Jeffrey Zeldmans blog post</a>
26 * on tag clouds for a more in-depth description.
28 public final class Category
implements Serializable
, Comparable
<Category
> {
30 public static final long serialVersionUID
= 8556134984576082397L;
32 private String category
;
34 public Category(String category
) {
35 if (category
== null) {
36 throw new NullPointerException("category must not be null");
38 this.category
= category
;
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")
51 public String
getCategory() {
56 public int compareTo(Category o
) {
57 return category
.compareTo(o
.category
);
61 public boolean equals(Object o
) {
65 if (o
== null || getClass() != o
.getClass()) {
69 Category category1
= (Category
) o
;
71 if (!category
.equals(category1
.category
)) {
79 public int hashCode() {
80 return category
.hashCode();