public class KeyMetadata<P> extends Object
Constructor and Description |
---|
KeyMetadata(Class<P> clazz,
CreateContext ctx,
Path path) |
Modifier and Type | Method and Description |
---|---|
String |
getIdFieldName() |
Class<?> |
getIdFieldType() |
String |
getKind() |
String |
getParentFieldName() |
com.google.appengine.api.datastore.Key |
getRawKey(P pojo)
Gets a key composed of the relevant id and parent fields in the object.
|
com.google.appengine.api.datastore.Key |
getRawKeyOrNull(P pojo)
Gets a key composed of the relevant id and parent fields in the object.
|
boolean |
hasParentField() |
com.google.appengine.api.datastore.Entity |
initEntity(P pojo)
This hides all the messiness of trying to create an Entity from an object that:
|
boolean |
isIdGeneratable() |
boolean |
requiresAutogeneratedId(P entity)
Change this slightly to just a null check on the id so that null String will be allowed.
|
void |
setKey(P pojo,
com.google.appengine.api.datastore.PropertyContainer container,
LoadContext ctx,
Path containerPath)
Sets the key (from the container) onto the POJO id/parent fields.
|
void |
setLongId(P pojo,
Long id)
Sets the numeric id field
|
boolean |
shouldLoadParent(Set<Class<?>> enabledGroups) |
public KeyMetadata(Class<P> clazz, CreateContext ctx, Path path)
public void setKey(P pojo, com.google.appengine.api.datastore.PropertyContainer container, LoadContext ctx, Path containerPath)
public String getKind()
public com.google.appengine.api.datastore.Entity initEntity(P pojo)
This hides all the messiness of trying to create an Entity from an object that:
public com.google.appengine.api.datastore.Key getRawKeyOrNull(P pojo)
pojo
- must be of the entityClass type for this metadata.public com.google.appengine.api.datastore.Key getRawKey(P pojo)
pojo
- must be of the entityClass type for this metadata.IllegalArgumentException
- if pojo has a null idpublic String getParentFieldName()
public String getIdFieldName()
public Class<?> getIdFieldType()
public boolean hasParentField()
public boolean shouldLoadParent(Set<Class<?>> enabledGroups)
public boolean isIdGeneratable()
public boolean requiresAutogeneratedId(P entity)
Copyright © 2016. All rights reserved.