本文整理匯總了Java中com.google.appengine.api.datastore.Entity.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.getKey方法的具體用法?Java Entity.getKey怎麽用?Java Entity.getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.appengine.api.datastore.Entity
的用法示例。
在下文中一共展示了Entity.getKey方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import com.google.appengine.api.datastore.Entity; //導入方法依賴的package包/類
@Override
public void process() {
UserService userService = UserServiceFactory.getUserService();
// Step 1: Add Text into DB.
Entity textEntity = getNewEntity();
textEntity.setProperty("rawText", new Text(text));
textEntity.setProperty("user",
userService.getCurrentUser().getNickname());
textEntity.setProperty("date", new Date());
putIntoDatabase(textEntity);
Key parentKey = textEntity.getKey();
factory.setParentKey(parentKey);
// Step 2: Call other processors.
factory.createTypePredictor().process();
factory.createKnowledgeGraphBuilder().process();
factory.createSummaryGenerator().process();
}
示例2: toModel
import com.google.appengine.api.datastore.Entity; //導入方法依賴的package包/類
@Override
public <T> T toModel(Class<T> entityClass, Entity entity) {
try {
T instance = entityClass.newInstance();
Field idField = getIdField(entityClass);
Key key = entity.getKey();
Object id = (key.getName() != null ? key.getName() : key.getId());
idField.set(instance, id);
Map<String, Object> properties = entity.getProperties();
for (Map.Entry<String, Object> entry : properties.entrySet()) {
Field field = ReflectionUtils.findRequiredField(entityClass, entry.getKey());
ReflectionUtils.setField(field, instance, entry.getValue());
}
return instance;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
示例3: TextQuery
import com.google.appengine.api.datastore.Entity; //導入方法依賴的package包/類
public TextQuery(Entity textEntity, int limit) {
Key parentKey = textEntity.getKey();
KnowledgeQuery kq = new KnowledgeQuery(parentKey);
List<KnowledgeNodeDataStore> keywords = kq.getTop3KeyWords();
List<List<KnowledgeNodeDataStore>> knowledgeNodeDataStoreList =
kq.getListOfKnowledgeNodes();
List<AnnotatedSentence> annotatedSentenceList =
new SummaryQuery(parentKey).getAnnotatedSentences(limit);
textDataStore = new TextDataStore(textEntity, keywords,
knowledgeNodeDataStoreList,
annotatedSentenceList, limit);
}