public class Key<T> extends Object implements Serializable, Comparable<Key<?>>
A typesafe wrapper for the datastore Key object.
Modifier and Type | Field and Description |
---|---|
protected Key<?> |
parent
Cache the instance of the parent wrapper to avoid unnecessary garbage
|
protected com.google.appengine.api.datastore.Key |
raw |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Key<?> other)
Compares based on comparison of the raw key
|
static <T> Key<T> |
create(Class<? extends T> kindClass,
long id)
Key.create(Blah.class, id) is easier to type than new Key
|
static <T> Key<T> |
create(Class<? extends T> kindClass,
String name)
Key.create(Blah.class, name) is easier to type than new Key
|
static <T> Key<T> |
create(com.google.appengine.api.datastore.Key raw)
Key.create(key) is easier to type than new Key
|
static <T> Key<T> |
create(Key<?> parent,
Class<? extends T> kindClass,
long id)
Key.create(parent, Blah.class, id) is easier to type than new Key
|
static <T> Key<T> |
create(Key<?> parent,
Class<? extends T> kindClass,
String name)
Key.create(parent, Blah.class, name) is easier to type than new Key
|
static <T> Key<T> |
create(String webSafeString)
Key.create(webSafeString) is easier to type than new Key
|
static <T> Key<T> |
create(T pojo)
Create a key from a registered POJO entity.
|
boolean |
equals(Object obj) |
boolean |
equivalent(Key<T> other)
A type-safe equivalence comparison
|
boolean |
equivalent(Ref<T> other)
A type-safe equivalence comparison
|
long |
getId() |
String |
getKind() |
static String |
getKind(Class<?> clazz)
Determines the kind for a Class, as understood by the datastore.
|
String |
getName() |
<V> Key<V> |
getParent() |
com.google.appengine.api.datastore.Key |
getRaw() |
<V> Key<V> |
getRoot()
Gets the root of a parent graph of keys.
|
String |
getString()
Call KeyFactory.keyToString() on the underlying Key.
|
int |
hashCode() |
static <V> Key<V> |
key(com.google.appengine.api.datastore.Key raw)
Easy null-safe conversion of the raw key.
|
static com.google.appengine.api.datastore.Key |
key(Key<?> typed)
Easy null-safe conversion of the typed key.
|
String |
toString()
Creates a human-readable version of this key
|
String |
toWebSafeString()
Call KeyFactory.keyToString() on the underlying Key.
|
static <T> Key<T> |
valueOf(String webSafeString)
This is an alias for Key.create(String) which exists for JAX-RS compliance.
|
protected com.google.appengine.api.datastore.Key raw
protected transient Key<?> parent
public static <T> Key<T> create(com.google.appengine.api.datastore.Key raw)
public static <T> Key<T> create(Class<? extends T> kindClass, long id)
public static <T> Key<T> create(Class<? extends T> kindClass, String name)
public static <T> Key<T> create(Key<?> parent, Class<? extends T> kindClass, long id)
public static <T> Key<T> create(Key<?> parent, Class<? extends T> kindClass, String name)
public static <T> Key<T> create(String webSafeString)
public static <T> Key<T> valueOf(String webSafeString)
public static <T> Key<T> create(T pojo)
public com.google.appengine.api.datastore.Key getRaw()
public long getId()
public String getName()
public 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 Comparable<Key<?>>
public String toString()
public String getString()
public String toWebSafeString()
public static <V> Key<V> key(com.google.appengine.api.datastore.Key raw)
public static com.google.appengine.api.datastore.Key key(Key<?> typed)
Copyright © 2016. All rights reserved.