T - The type of the entitypublic class Key<T> extends Object implements Serializable, Comparable<Key<T>>
The key object; this class is take from the app-engine datastore (mostly) implementation. It is also Serializable and GWT-safe, enabling your entity objects to be used for GWT RPC should you so desire.
You may use normal DBRef objects as relationships in your entities if you desire neither type safety nor GWT-ability.
| Modifier | Constructor and Description |
|---|---|
protected |
Key()
For GWT serialization
|
|
Key(Class<? extends T> type,
String collection,
byte[] idBytes)
Create a key with an id
|
|
Key(Class<? extends T> type,
String collection,
Object id)
Create a key with an id
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Key<T> other) |
boolean |
equals(Object obj) |
String |
getCollection() |
Object |
getId() |
Class<? extends T> |
getType() |
int |
hashCode() |
void |
setCollection(String collection)
Sets the collection name.
|
void |
setType(Class<? extends T> clazz)
Sets the type of the entity for this Key
|
String |
toString() |
protected Key()
public Key(Class<? extends T> type, String collection, Object id)
type - the type of the entitycollection - the collection in which the entity livesid - the value of the entity's IDpublic int compareTo(Key<T> other)
compareTo in interface Comparable<Key<T>>public String getCollection()
public void setCollection(String collection)
collection - the collection to usepublic Object getId()
public void setType(Class<? extends T> clazz)
clazz - the type to use