本文整理汇总了Java中com.google.cloud.datastore.Entity.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getString方法的具体用法?Java Entity.getString怎么用?Java Entity.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.cloud.datastore.Entity
的用法示例。
在下文中一共展示了Entity.getString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseWorkflowInstance
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
private WorkflowInstance parseWorkflowInstance(Entity activeWorkflowInstance) {
final String componentId = activeWorkflowInstance.getString(PROPERTY_COMPONENT);
final String workflowId = activeWorkflowInstance.getString(PROPERTY_WORKFLOW);
final String parameter = activeWorkflowInstance.getString(PROPERTY_PARAMETER);
return WorkflowInstance.create(WorkflowId.create(componentId, workflowId), parameter);
}
示例2: retrieve
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
@Override
public List<Message> retrieve(int limit) {
// Get Message saved in Datastore
Datastore datastore = getDatastoreInstance();
Query<Entity> query =
Query.newEntityQueryBuilder()
.setKind(messagesKind)
.setLimit(limit)
.addOrderBy(StructuredQuery.OrderBy.desc("publishTime"))
.build();
QueryResults<Entity> results = datastore.run(query);
List<Message> messages = new ArrayList<>();
while (results.hasNext()) {
Entity entity = results.next();
Message message = new Message(entity.getString("messageId"));
String data = entity.getString("data");
if (data != null) {
message.setData(data);
}
String publishTime = entity.getString("publishTime");
if (publishTime != null) {
message.setPublishTime(publishTime);
}
if (entity.contains("sourceLang")) {
String sourceLang = entity.getString("sourceLang");
if (sourceLang != null) {
message.setSourceLang(sourceLang);
}
}
if (entity.contains("targetLang")) {
String targetLang = entity.getString("targetLang");
if (targetLang != null) {
message.setTargetLang(targetLang);
}
}
messages.add(message);
}
return messages;
}
示例3: retrieve
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
@Override
public List<Message> retrieve(int limit) {
// Get Message saved in Datastore
Datastore datastore = getDatastoreInstance();
Query<Entity> query =
Query.newEntityQueryBuilder()
.setKind(messagesKind)
.setLimit(limit)
.addOrderBy(StructuredQuery.OrderBy.desc("publishTime"))
.build();
QueryResults<Entity> results = datastore.run(query);
List<Message> messages = new ArrayList<>();
while (results.hasNext()) {
Entity entity = results.next();
Message message = new Message(entity.getString("messageId"));
String data = entity.getString("data");
if (data != null) {
message.setData(data);
}
String publishTime = entity.getString("publishTime");
if (publishTime != null) {
message.setPublishTime(publishTime);
}
messages.add(message);
}
return messages;
}
示例4: getUser
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
/**
* Return the user with the given id.
*/
User getUser(String id) {
Entity entity = datastore.get(keyFactory.newKey(id));
return entity == null
? null
: new User(entity.getString("id"), entity.getString("name"), entity.getString("email"));
}
示例5: Greeting
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
public Greeting(Entity entity) {
key = entity.hasKey() ? entity.key() : null;
authorEmail = entity.contains("authorEmail") ? entity.getString("authorEmail") : null;
authorId = entity.contains("authorId") ? entity.getString("authorId") : null;
date = entity.contains("date") ? entity.getDateTime("date").toDate() : null;
content = entity.contains("content") ? entity.getString("content") : null;
}
示例6: Greeting
import com.google.cloud.datastore.Entity; //导入方法依赖的package包/类
public Greeting(Entity entity) {
key = entity.hasKey() ? entity.getKey() : null;
authorEmail = entity.contains("authorEmail") ? entity.getString("authorEmail") : null;
authorId = entity.contains("authorId") ? entity.getString("authorId") : null;
date = entity.contains("date") ? entity.getTimestamp("date").toSqlTimestamp() : null;
content = entity.contains("content") ? entity.getString("content") : null;
}