|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.objectify.Key<T>
public class Key<T>
A typesafe wrapper for the datastore Key object.
Field Summary | |
---|---|
protected Key<?> |
parent
Cache the instance of the parent wrapper to avoid unnecessary garbage |
protected com.google.appengine.api.datastore.Key |
raw
|
Constructor Summary | |
---|---|
protected |
Key()
For GWT serialization |
|
Key(java.lang.Class<? extends T> kindClass,
long id)
Create a key with a long id |
|
Key(java.lang.Class<? extends T> kindClass,
java.lang.String name)
Create a key with a String name |
|
Key(com.google.appengine.api.datastore.Key raw)
Wrap a raw Key |
|
Key(Key<?> parent,
java.lang.Class<? extends T> kindClass,
long id)
Create a key with a parent and a long id |
|
Key(Key<?> parent,
java.lang.Class<? extends T> kindClass,
java.lang.String name)
Create a key with a parent and a String name |
|
Key(java.lang.String webSafe)
Reconstitute a Key from a web safe string. |
Method Summary | ||
---|---|---|
int |
compareTo(Key<?> other)
Compares based on comparison of the raw key |
|
static
|
create(java.lang.Class<? extends T> kindClass,
long id)
Key.create(Blah.class, id) is easier to type than new Key |
|
static
|
create(java.lang.Class<? extends T> kindClass,
java.lang.String name)
Key.create(Blah.class, name) is easier to type than new Key |
|
static
|
create(Key<?> parent,
java.lang.Class<? extends T> kindClass,
long id)
Key.create(parent, Blah.class, id) is easier to type than new Key |
|
static
|
create(Key<?> parent,
java.lang.Class<? extends T> kindClass,
java.lang.String name)
Key.create(parent, Blah.class, name) is easier to type than new Key |
|
static
|
create(java.lang.String webSafeString)
Key.create(webSafeString) is easier to type than new Key |
|
boolean |
equals(java.lang.Object obj)
|
|
long |
getId()
|
|
java.lang.String |
getKind()
|
|
static java.lang.String |
getKind(java.lang.Class<?> clazz)
Determines the kind for a Class, as understood by the datastore. |
|
java.lang.String |
getName()
|
|
|
getParent()
|
|
com.google.appengine.api.datastore.Key |
getRaw()
|
|
|
getRoot()
Gets the root of a parent graph of keys. |
|
java.lang.String |
getString()
Call KeyFactory.keyToString() on the underlying Key. |
|
int |
hashCode()
|
|
static com.google.appengine.api.datastore.Key |
raw(Key<?> typed)
Easy null-safe conversion of the typed key. |
|
java.lang.String |
toString()
Creates a human-readable version of this key |
|
static
|
typed(com.google.appengine.api.datastore.Key raw)
Easy null-safe conversion of the raw key. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected com.google.appengine.api.datastore.Key raw
protected transient Key<?> parent
Constructor Detail |
---|
protected Key()
public Key(com.google.appengine.api.datastore.Key raw)
public Key(java.lang.Class<? extends T> kindClass, long id)
public Key(java.lang.Class<? extends T> kindClass, java.lang.String name)
public Key(Key<?> parent, java.lang.Class<? extends T> kindClass, long id)
public Key(Key<?> parent, java.lang.Class<? extends T> kindClass, java.lang.String name)
public Key(java.lang.String webSafe)
Method Detail |
---|
public static <T> Key<T> create(java.lang.Class<? extends T> kindClass, long id)
public static <T> Key<T> create(java.lang.Class<? extends T> kindClass, java.lang.String name)
public static <T> Key<T> create(Key<?> parent, java.lang.Class<? extends T> kindClass, long id)
public static <T> Key<T> create(Key<?> parent, java.lang.Class<? extends T> kindClass, java.lang.String name)
public static <T> Key<T> create(java.lang.String webSafeString)
public com.google.appengine.api.datastore.Key getRaw()
public long getId()
public java.lang.String getName()
public java.lang.String getKind()
public <V> Key<V> getParent()
public <V> Key<V> getRoot()
public int compareTo(Key<?> other)
Compares based on comparison of the raw key
compareTo
in interface java.lang.Comparable<Key<?>>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getString()
public static <V> Key<V> typed(com.google.appengine.api.datastore.Key raw)
public static com.google.appengine.api.datastore.Key raw(Key<?> typed)
public static java.lang.String getKind(java.lang.Class<?> clazz)
Determines the kind for a Class, as understood by the datastore. The logic for this is approximately:
java.lang.IllegalArgumentException
- if a kind cannot be determined (ie @Subclass with invalid hierarchy).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |