当前位置: 首页>>代码示例>>Java>>正文


Java Entity.getString方法代码示例

本文整理汇总了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);
}
 
开发者ID:spotify,项目名称:styx,代码行数:8,代码来源:DatastoreStorage.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:getting-started-java,代码行数:41,代码来源:MessageRepositoryImpl.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:29,代码来源:MessageRepositoryImpl.java

示例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"));
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:10,代码来源:UserService.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:8,代码来源:Greeting.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:9,代码来源:Greeting.java


注:本文中的com.google.cloud.datastore.Entity.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。