com.linecorp.centraldogma.internal.thrift.Query.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(112)

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

Query.<init>介绍

[英]Performs a deep copy on other.
[中]在其他计算机上执行深度复制。

代码示例

代码示例来源:origin: line/centraldogma

public Query deepCopy() {
 return new Query(this);
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded

public Query deepCopy() {
 return new Query(this);
}

代码示例来源:origin: line/centraldogma

@Override
protected Query doForward(com.linecorp.centraldogma.common.Query<?> query) {
  switch (query.type()) {
    case IDENTITY:
      return new Query(query.path(), QueryType.IDENTITY, Collections.emptyList());
    case JSON_PATH:
      return new Query(query.path(), QueryType.JSON_PATH, query.expressions());
  }
  throw new Error();
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded

@Override
protected Query doForward(com.linecorp.centraldogma.common.Query<?> query) {
  switch (query.type()) {
    case IDENTITY:
      return new Query(query.path(), QueryType.IDENTITY, Collections.emptyList());
    case JSON_PATH:
      return new Query(query.path(), QueryType.JSON_PATH, query.expressions());
  }
  throw new Error();
}

代码示例来源:origin: line/centraldogma

case 4: // QUERY
 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  struct.query = new Query();
  struct.query.read(iprot);
  struct.setQueryIsSet(true);

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded

case 4: // QUERY
 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  struct.query = new Query();
  struct.query.read(iprot);
  struct.setQueryIsSet(true);

代码示例来源:origin: line/centraldogma

/**
 * Performs a deep copy on <i>other</i>.
 */
public NamedQuery(NamedQuery other) {
 __isset_bitfield = other.__isset_bitfield;
 if (other.isSetName()) {
  this.name = other.name;
 }
 this.enabled = other.enabled;
 if (other.isSetRepositoryName()) {
  this.repositoryName = other.repositoryName;
 }
 if (other.isSetQuery()) {
  this.query = new Query(other.query);
 }
 if (other.isSetComment()) {
  this.comment = new Comment(other.comment);
 }
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded

/**
 * Performs a deep copy on <i>other</i>.
 */
public NamedQuery(NamedQuery other) {
 __isset_bitfield = other.__isset_bitfield;
 if (other.isSetName()) {
  this.name = other.name;
 }
 this.enabled = other.enabled;
 if (other.isSetRepositoryName()) {
  this.repositoryName = other.repositoryName;
 }
 if (other.isSetQuery()) {
  this.query = new Query(other.query);
 }
 if (other.isSetComment()) {
  this.comment = new Comment(other.comment);
 }
}

代码示例来源:origin: line/centraldogma

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, NamedQuery struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.name = iprot.readString();
  struct.setNameIsSet(true);
  struct.enabled = iprot.readBool();
  struct.setEnabledIsSet(true);
  struct.repositoryName = iprot.readString();
  struct.setRepositoryNameIsSet(true);
  struct.query = new Query();
  struct.query.read(iprot);
  struct.setQueryIsSet(true);
  BitSet incoming = iprot.readBitSet(1);
  if (incoming.get(0)) {
   struct.comment = new Comment();
   struct.comment.read(iprot);
   struct.setCommentIsSet(true);
  }
 }
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common-legacy-shaded

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, NamedQuery struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.name = iprot.readString();
  struct.setNameIsSet(true);
  struct.enabled = iprot.readBool();
  struct.setEnabledIsSet(true);
  struct.repositoryName = iprot.readString();
  struct.setRepositoryNameIsSet(true);
  struct.query = new Query();
  struct.query.read(iprot);
  struct.setQueryIsSet(true);
  BitSet incoming = iprot.readBitSet(1);
  if (incoming.get(0)) {
   struct.comment = new Comment();
   struct.comment.read(iprot);
   struct.setCommentIsSet(true);
  }
 }
}

代码示例来源:origin: line/centraldogma

@Test
public void thrift() throws Exception {
  final com.linecorp.centraldogma.internal.thrift.Revision head =
      new com.linecorp.centraldogma.internal.thrift.Revision(-1, 0);
  final Query query = new Query(PATH, QueryType.IDENTITY, ImmutableList.of());
  // Should fail to decode without the decompressor.
  final Iface clientWithoutDecompressor = new ClientBuilder(
      "ttext+http://127.0.0.1:" + rule.serverAddress().getPort() + "/cd/thrift/v1")
      .setHttpHeader(HttpHeaderNames.AUTHORIZATION, "bearer " + CsrfToken.ANONYMOUS)
      .setHttpHeader(HttpHeaderNames.ACCEPT_ENCODING, "deflate")
      .build(Iface.class);
  assertThatThrownBy(() -> clientWithoutDecompressor.getFile(PROJ, REPO, head, query))
      .isInstanceOf(TException.class)
      .hasCauseInstanceOf(JsonParseException.class);
  // Should succeed to decode with the decompressor.
  final Iface clientWithDecompressor = Clients.newDerivedClient(
      clientWithoutDecompressor,
      options -> new ClientOptionsBuilder(options)
          .decorator(HttpDecodingClient.newDecorator())
          .build());
  final GetFileResult result = clientWithDecompressor.getFile(PROJ, REPO, head, query);
  assertThat(result.getContent()).contains(CONTENT);
}

相关文章