public class Keys extends Object
Gives us a slightly more organized interface for manipulating keys. While this is part of Objectify's public interface, you probably shouldn't use it. It's subject to change without notice. If you want to work with keys, use the Key.create() methods.
Modifier and Type | Method and Description |
---|---|
<T> Key<T> |
anythingToKey(Object keyOrEntity)
Gets the Key
|
com.google.appengine.api.datastore.Key |
anythingToRawKey(Object keyOrEntity)
Gets the raw datstore Key given an object that might be a Key, Key
|
<T> KeyMetadata<T> |
getMetadata(Key<T> key) |
<T> KeyMetadata<T> |
getMetadataSafe(Class<T> clazz) |
<T> KeyMetadata<T> |
getMetadataSafe(T pojo) |
<T> Key<T> |
keyOf(T pojo) |
com.google.appengine.api.datastore.Key |
rawKeyOf(Object pojo) |
boolean |
requiresAutogeneratedId(Object entity) |
public Keys(Registrar registrar)
public <T> Key<T> keyOf(T pojo)
public com.google.appengine.api.datastore.Key rawKeyOf(Object pojo)
public <T> KeyMetadata<T> getMetadataSafe(Class<T> clazz)
IllegalStateException
- if the pojo class has not been registeredpublic <T> KeyMetadata<T> getMetadataSafe(T pojo)
IllegalStateException
- if the pojo class has not been registeredpublic <T> KeyMetadata<T> getMetadata(Key<T> key)
public <T> Key<T> anythingToKey(Object keyOrEntity)
Gets the Key
keyOrEntity
- must be a Key, KeyNullPointerException
- if keyOrEntity is nullIllegalArgumentException
- if keyOrEntity is not a Key, Keypublic com.google.appengine.api.datastore.Key anythingToRawKey(Object keyOrEntity)
Gets the raw datstore Key given an object that might be a Key, Key
keyOrEntity
- must be a Key, KeyNullPointerException
- if keyOrEntity is nullIllegalArgumentException
- if keyOrEntity is not a Key, Keypublic boolean requiresAutogeneratedId(Object entity)
Copyright © 2015. All rights reserved.