public class EntityClassTranslator<T> extends ClassTranslator<T> implements KeyMetadata<T>
Translator which can maps the root of an entity. There is no factory associated with this; you just instantiate one as necessary.
clazz, fact, owners, props
Constructor and Description |
---|
EntityClassTranslator(Type type,
CreateContext ctx) |
Modifier and Type | Method and Description |
---|---|
protected void |
foundTranslatableProperty(TranslatableProperty<Object> tprop)
Look for the id and parent properties
|
String |
getIdFieldName() |
Class<?> |
getIdFieldType() |
String |
getKind() |
String |
getParentFieldName() |
com.google.appengine.api.datastore.Key |
getRawKey(T pojo)
Gets a key composed of the relevant id and parent fields in the object.
|
boolean |
hasParentField() |
com.google.appengine.api.datastore.Entity |
initEntity(T pojo)
This hides all the messiness of trying to create an Entity from an object that:
|
boolean |
isIdGeneratable() |
void |
setKey(T pojo,
com.google.appengine.api.datastore.Key key,
LoadContext ctx)
Sets the key onto the POJO id/parent fields
|
void |
setLongId(T pojo,
Long id)
Sets the numeric id field
|
boolean |
shouldLoadParent(Set<Class<?>> enabledGroups) |
getTranslatedClass, loadMap, saveMap
loadAbstract, saveAbstract
load, save
public EntityClassTranslator(Type type, CreateContext ctx)
protected void foundTranslatableProperty(TranslatableProperty<Object> tprop)
foundTranslatableProperty
in class ClassTranslator<T>
public String getKind()
getKind
in interface KeyMetadata<T>
public void setKey(T pojo, com.google.appengine.api.datastore.Key key, LoadContext ctx)
KeyMetadata
setKey
in interface KeyMetadata<T>
public com.google.appengine.api.datastore.Entity initEntity(T pojo)
KeyMetadata
This hides all the messiness of trying to create an Entity from an object that:
initEntity
in interface KeyMetadata<T>
public com.google.appengine.api.datastore.Key getRawKey(T pojo)
KeyMetadata
getRawKey
in interface KeyMetadata<T>
pojo
- must be of the entityClass type for this metadata.public String getParentFieldName()
getParentFieldName
in interface KeyMetadata<T>
public String getIdFieldName()
getIdFieldName
in interface KeyMetadata<T>
public Class<?> getIdFieldType()
getIdFieldType
in interface KeyMetadata<T>
public boolean hasParentField()
hasParentField
in interface KeyMetadata<T>
public boolean shouldLoadParent(Set<Class<?>> enabledGroups)
shouldLoadParent
in interface KeyMetadata<T>
public boolean isIdGeneratable()
isIdGeneratable
in interface KeyMetadata<T>
public void setLongId(T pojo, Long id)
KeyMetadata
setLongId
in interface KeyMetadata<T>
Copyright © 2014. All rights reserved.