com.couchbase.client.java.document.json.JsonObject.removeKey()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(86)

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

JsonObject.removeKey介绍

[英]Removes an entry from the JsonObject.
[中]从JsonObject中删除一个条目。

代码示例

代码示例来源:origin: org.springframework.data/spring-data-couchbase

@Override
public <T>Observable<T> findByN1QL(N1qlQuery query, Class<T> entityClass) {
  return queryN1QL(query)
      .flatMap(asyncN1qlQueryResult -> asyncN1qlQueryResult.errors()
          .flatMap(error -> Observable.error(new CouchbaseQueryExecutionException("Unable to execute n1ql query due to error:" + error.toString())))
          .switchIfEmpty(asyncN1qlQueryResult.rows()))
      .map(row -> {
        JsonObject json = ((AsyncN1qlQueryRow)row).value();
        String id = json.getString(TemplateUtils.SELECT_ID);
        Long cas = json.getLong(TemplateUtils.SELECT_CAS);
        if (id == null || cas == null) {
          throw new CouchbaseQueryExecutionException("Unable to retrieve enough metadata for N1QL to entity mapping, " +
              "have you selected " + TemplateUtils.SELECT_ID + " and " + TemplateUtils.SELECT_CAS + "?");
        }
        json = json.removeKey(TemplateUtils.SELECT_ID).removeKey(TemplateUtils.SELECT_CAS);
        RawJsonDocument entityDoc = RawJsonDocument.create(id, json.toString(), cas);
        T decoded = mapToEntity(id, entityDoc, entityClass);
        return decoded;
      })
      .doOnError(throwable -> Observable.error(new CouchbaseQueryExecutionException("Unable to execute n1ql query", throwable)));
}

代码示例来源:origin: spring-projects/spring-data-couchbase

@Override
public <T>Observable<T> findByN1QL(N1qlQuery query, Class<T> entityClass) {
  return queryN1QL(query)
      .flatMap(asyncN1qlQueryResult -> asyncN1qlQueryResult.errors()
          .flatMap(error -> Observable.error(new CouchbaseQueryExecutionException("Unable to execute n1ql query due to error:" + error.toString())))
          .switchIfEmpty(asyncN1qlQueryResult.rows()))
      .map(row -> {
        JsonObject json = ((AsyncN1qlQueryRow)row).value();
        String id = json.getString(TemplateUtils.SELECT_ID);
        Long cas = json.getLong(TemplateUtils.SELECT_CAS);
        if (id == null || cas == null) {
          throw new CouchbaseQueryExecutionException("Unable to retrieve enough metadata for N1QL to entity mapping, " +
              "have you selected " + TemplateUtils.SELECT_ID + " and " + TemplateUtils.SELECT_CAS + "?");
        }
        json = json.removeKey(TemplateUtils.SELECT_ID).removeKey(TemplateUtils.SELECT_CAS);
        RawJsonDocument entityDoc = RawJsonDocument.create(id, json.toString(), cas);
        T decoded = mapToEntity(id, entityDoc, entityClass);
        return decoded;
      })
      .doOnError(throwable -> Observable.error(new CouchbaseQueryExecutionException("Unable to execute n1ql query", throwable)));
}

代码示例来源:origin: spring-projects/spring-data-couchbase

"have you selected " + SELECT_ID + " and " + SELECT_CAS + "?");
json = json.removeKey(SELECT_ID).removeKey(SELECT_CAS);
RawJsonDocument entityDoc = RawJsonDocument.create(id, json.toString(), cas);
T decoded = mapToEntity(id, entityDoc, entityClass);

代码示例来源:origin: org.springframework.data/spring-data-couchbase

"have you selected " + SELECT_ID + " and " + SELECT_CAS + "?");
json = json.removeKey(SELECT_ID).removeKey(SELECT_CAS);
RawJsonDocument entityDoc = RawJsonDocument.create(id, json.toString(), cas);
T decoded = mapToEntity(id, entityDoc, entityClass);

代码示例来源:origin: com.couchbase.client/java-client

parent.removeKey(lastPointer);
parent.put(JsonObject.ENCRYPTION_PREFIX + lastPointer, encryptedVal);

相关文章