com.google.cloud.datastore.Datastore.getOptions()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中com.google.cloud.datastore.Datastore.getOptions()方法的一些代码示例,展示了Datastore.getOptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Datastore.getOptions()方法的具体详情如下:
包路径:com.google.cloud.datastore.Datastore
类名称:Datastore
方法名:getOptions

Datastore.getOptions介绍

暂无

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testGetOptions() {
 assertSame(options, datastore.getOptions());
}

代码示例来源:origin: googleapis/google-cloud-java

Entity entity5 = Entity.newBuilder(KEY5).set("value", "value").build();
datastore.add(ENTITY3, entity4, entity5);
DatastoreRpc datastoreRpc = datastore.getOptions().getDatastoreRpcV1();
List<RunQueryResponse> responses = new ArrayList<>();
Query<Entity> query = Query.newEntityQueryBuilder().build();

代码示例来源:origin: spotify/styx

@Override
public DatastoreOptions getOptions() {
 return delegate.getOptions();
}

代码示例来源:origin: sai-pullabhotla/catatumbo

/**
 * Returns the effective namespace. If a namespace was specified using {@link Tenant}, it will be
 * returned. Otherwise, the namespace of this EntityManager is returned.
 * 
 * @return the effective namespace.
 */
String getEffectiveNamespace() {
 String namespace = Tenant.getNamespace();
 if (namespace == null) {
  namespace = datastore.getOptions().getNamespace();
 }
 return namespace;
}

代码示例来源:origin: sai-pullabhotla/catatumbo

/**
 * Returns an IncompleteKey of the given entity.
 * 
 * @param entity
 *          the entity
 * @return the incomplete key
 */
private IncompleteKey getIncompleteKey(Object entity) {
 EntityMetadata entityMetadata = EntityIntrospector.introspect(entity.getClass());
 String kind = entityMetadata.getKind();
 ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
 DatastoreKey parentKey = null;
 IncompleteKey incompleteKey = null;
 if (parentKeyMetadata != null) {
  parentKey = (DatastoreKey) IntrospectionUtils.getFieldValue(parentKeyMetadata, entity);
 }
 if (parentKey != null) {
  incompleteKey = IncompleteKey.newBuilder(parentKey.nativeKey(), kind).build();
 } else {
  incompleteKey = IncompleteKey.newBuilder(datastore.getOptions().getProjectId(), kind)
    .setNamespace(getEffectiveNamespace()).build();
 }
 return incompleteKey;
}

相关文章