static ImmutableList<RpcElement> toElements(ImmutableList<Rpc> rpcs) { ImmutableList.Builder<RpcElement> elements = new ImmutableList.Builder<>(); for (Rpc rpc : rpcs) { elements.add(RpcElement.builder(rpc.location) .documentation(rpc.documentation) .name(rpc.name) .requestType(rpc.requestTypeElement) .responseType(rpc.responseTypeElement) .requestStreaming(rpc.requestStreaming) .responseStreaming(rpc.responseStreaming) .options(rpc.options.toElements()) .build()); } return elements.build(); } }
public static Builder builder(Location location) { return new AutoValue_RpcElement.Builder() .documentation("") .location(location) .requestStreaming(false) .responseStreaming(false) .options(ImmutableList.<OptionElement>of()); }
@Test public void rpcWithOptionsToSchema() { RpcElement rpc = RpcElement.builder(location) .name("Name") .requestType("RequestType") .responseType("ResponseType") .options(ImmutableList.of( OptionElement.create("foo", Kind.STRING, "bar"))) .build(); String expected = "" + "rpc Name (RequestType) returns (ResponseType) {\n" + " option foo = \"bar\";\n" + "};\n"; assertThat(rpc.toSchema()).isEqualTo(expected); }
builder.options(options.build()); } else if (readChar() != ';') throw unexpected("expected ';'");
builder.options(options.build()); } else { reader.require(';');
static ImmutableList<RpcElement> toElements(ImmutableList<Rpc> rpcs) { ImmutableList.Builder<RpcElement> elements = new ImmutableList.Builder<>(); for (Rpc rpc : rpcs) { elements.add(RpcElement.builder(rpc.location) .documentation(rpc.documentation) .name(rpc.name) .requestType(rpc.requestTypeElement) .responseType(rpc.responseTypeElement) .requestStreaming(rpc.requestStreaming) .responseStreaming(rpc.responseStreaming) .options(rpc.options.toElements()) .build()); } return elements.build(); } }
static ImmutableList<RpcElement> toElements(ImmutableList<Rpc> rpcs) { ImmutableList.Builder<RpcElement> elements = new ImmutableList.Builder<>(); for (Rpc rpc : rpcs) { elements.add(RpcElement.builder(rpc.location) .documentation(rpc.documentation) .name(rpc.name) .requestType(rpc.requestTypeElement) .responseType(rpc.responseTypeElement) .requestStreaming(rpc.requestStreaming) .responseStreaming(rpc.responseStreaming) .options(rpc.options.toElements()) .build()); } return elements.build(); } }
public static Builder builder(Location location) { return new AutoValue_RpcElement.Builder() .documentation("") .location(location) .requestStreaming(false) .responseStreaming(false) .options(ImmutableList.<OptionElement>of()); }
public static Builder builder(Location location) { return new AutoValue_RpcElement.Builder() .documentation("") .location(location) .requestStreaming(false) .responseStreaming(false) .options(ImmutableList.<OptionElement>of()); }
.requestType("Message2") .responseType("Message1") .options(ImmutableList.<OptionElement>of( OptionElement.create("methodoption", OptionElement.Kind.NUMBER, 1))) .build()))
builder.options(options.build()); } else { reader.require(';');
.requestType("PurchaseRequest") .responseType("PurchaseResponse") .options(ImmutableList.of( OptionElement.create("squareup.sake.timeout", Kind.NUMBER, "15", true), OptionElement.create("squareup.a.b", Kind.MAP, ImmutableMap.of("value",