Skip to content

Commit b1c9c27

Browse files
committed
Improve readability of generated code
1 parent 63578ec commit b1c9c27

File tree

3 files changed

+37
-31
lines changed

3 files changed

+37
-31
lines changed

vertx-grpc-docs/src/main/java/examples/GreeterClient.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package examples;
22

3+
import io.vertx.codegen.annotations.GenIgnore;
4+
import io.vertx.codegen.annotations.VertxGen;
35
import io.vertx.core.Future;
46
import io.vertx.core.Completable;
57
import io.vertx.core.Handler;
@@ -18,13 +20,13 @@
1820
/**
1921
* <p>A client for invoking the Greeter gRPC service.</p>
2022
*/
21-
@io.vertx.codegen.annotations.VertxGen
23+
@VertxGen
2224
public interface GreeterClient {
2325

2426
/**
2527
* SayHello protobuf RPC client service method.
2628
*/
27-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
29+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
2830
ServiceMethod<examples.HelloReply, examples.HelloRequest> SayHello = ServiceMethod.client(
2931
ServiceName.create("helloworld", "Greeter"),
3032
"SayHello",
@@ -34,7 +36,7 @@ public interface GreeterClient {
3436
/**
3537
* Json client service methods.
3638
*/
37-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
39+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
3840
final class Json {
3941

4042
/**
@@ -76,10 +78,10 @@ static GreeterClient create(GrpcClient client, SocketAddress host, io.vertx.grpc
7678
* @param request the examples.HelloRequest request message
7779
* @return a future of the examples.HelloReply response message
7880
*/
79-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
81+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
8082
Future<examples.HelloReply> sayHello(examples.HelloRequest request);
8183

82-
@io.vertx.codegen.annotations.GenIgnore
84+
@GenIgnore
8385
examples.HelloReply sayHello_sync(examples.HelloRequest request);
8486
}
8587

vertx-grpc-docs/src/main/java/examples/StreamingClient.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package examples;
22

3+
import io.vertx.codegen.annotations.GenIgnore;
4+
import io.vertx.codegen.annotations.VertxGen;
35
import io.vertx.core.Future;
46
import io.vertx.core.Completable;
57
import io.vertx.core.Handler;
@@ -18,13 +20,13 @@
1820
/**
1921
* <p>A client for invoking the Streaming gRPC service.</p>
2022
*/
21-
@io.vertx.codegen.annotations.VertxGen
23+
@VertxGen
2224
public interface StreamingClient {
2325

2426
/**
2527
* Source protobuf RPC client service method.
2628
*/
27-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
29+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
2830
ServiceMethod<examples.Item, examples.Empty> Source = ServiceMethod.client(
2931
ServiceName.create("streaming", "Streaming"),
3032
"Source",
@@ -34,7 +36,7 @@ public interface StreamingClient {
3436
/**
3537
* Sink protobuf RPC client service method.
3638
*/
37-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
39+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
3840
ServiceMethod<examples.Empty, examples.Item> Sink = ServiceMethod.client(
3941
ServiceName.create("streaming", "Streaming"),
4042
"Sink",
@@ -44,7 +46,7 @@ public interface StreamingClient {
4446
/**
4547
* Pipe protobuf RPC client service method.
4648
*/
47-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
49+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
4850
ServiceMethod<examples.Item, examples.Item> Pipe = ServiceMethod.client(
4951
ServiceName.create("streaming", "Streaming"),
5052
"Pipe",
@@ -54,7 +56,7 @@ public interface StreamingClient {
5456
/**
5557
* Json client service methods.
5658
*/
57-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
59+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
5860
final class Json {
5961

6062
/**
@@ -114,10 +116,10 @@ static StreamingClient create(GrpcClient client, SocketAddress host, io.vertx.gr
114116
* @param request the examples.Empty request message
115117
* @return a future of the examples.Item response messages
116118
*/
117-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
119+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
118120
Future<ReadStream<examples.Item>> source(examples.Empty request);
119121

120-
@io.vertx.codegen.annotations.GenIgnore
122+
@GenIgnore
121123
Stream<examples.Item> source_sync(examples.Empty request);
122124

123125
/**
@@ -126,7 +128,7 @@ static StreamingClient create(GrpcClient client, SocketAddress host, io.vertx.gr
126128
* @param completable a completable that will be passed a stream to which the examples.Item request messages can be written to.
127129
* @return a future of the examples.Empty response message
128130
*/
129-
@io.vertx.codegen.annotations.GenIgnore
131+
@GenIgnore
130132
Future<examples.Empty> sink(Completable<WriteStream<examples.Item>> completable);
131133

132134
/**
@@ -135,7 +137,7 @@ static StreamingClient create(GrpcClient client, SocketAddress host, io.vertx.gr
135137
* @param streamOfMessages a stream of messages to be sent to the service
136138
* @return a future of the examples.Empty response message
137139
*/
138-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
140+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
139141
Future<examples.Empty> sink(ReadStream<examples.Item> streamOfMessages);
140142

141143
/**
@@ -144,7 +146,7 @@ static StreamingClient create(GrpcClient client, SocketAddress host, io.vertx.gr
144146
* @param streamOfMessages a stream of messages to be sent to the service
145147
* @return a future of the examples.Empty response message
146148
*/
147-
@io.vertx.codegen.annotations.GenIgnore
149+
@GenIgnore
148150
default examples.Empty sink_sync(java.util.List<examples.Item> streamOfMessages) {
149151
return sink_sync(streamOfMessages.iterator());
150152
}
@@ -155,7 +157,7 @@ default examples.Empty sink_sync(java.util.List<examples.Item> streamOfMessages)
155157
* @param streamOfMessages a stream of messages to be sent to the service
156158
* @return a future of the examples.Empty response message
157159
*/
158-
@io.vertx.codegen.annotations.GenIgnore
160+
@GenIgnore
159161
examples.Empty sink_sync(java.util.Iterator<examples.Item> streamOfMessages);
160162

161163
/**
@@ -164,7 +166,7 @@ default examples.Empty sink_sync(java.util.List<examples.Item> streamOfMessages)
164166
* @param compltable a completable that will be passed a stream to which the examples.Item request messages can be written to.
165167
* @return a future of the examples.Item response messages
166168
*/
167-
@io.vertx.codegen.annotations.GenIgnore
169+
@GenIgnore
168170
Future<ReadStream<examples.Item>> pipe(Completable<WriteStream<examples.Item>> completable);
169171

170172
/**
@@ -173,7 +175,7 @@ default examples.Empty sink_sync(java.util.List<examples.Item> streamOfMessages)
173175
* @param streamOfMessages a stream of messages to be sent to the service
174176
* @return a future of the examples.Item response messages
175177
*/
176-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
178+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
177179
Future<ReadStream<examples.Item>> pipe(ReadStream<examples.Item> streamOfMessages);
178180
}
179181

vertx-grpc-protoc-plugin2/src/main/resources/client.mustache

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
package {{vertxPackageName}};
33
{{/vertxPackageName}}
44

5+
import io.vertx.codegen.annotations.GenIgnore;
6+
import io.vertx.codegen.annotations.VertxGen;
57
import io.vertx.core.Future;
68
import io.vertx.core.Completable;
79
import io.vertx.core.Handler;
@@ -20,14 +22,14 @@ import java.util.stream.Stream;
2022
/**
2123
* <p>A client for invoking the {{serviceName}} gRPC service.</p>
2224
*/
23-
@io.vertx.codegen.annotations.VertxGen
25+
@VertxGen
2426
public interface {{className}} {
2527
{{#allMethods}}
2628

2729
/**
2830
* {{methodName}} protobuf RPC client service method.
2931
*/
30-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
32+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
3133
ServiceMethod<{{outputType}}, {{inputType}}> {{methodName}} = ServiceMethod.client(
3234
ServiceName.create("{{packageName}}", "{{serviceName}}"),
3335
"{{methodName}}",
@@ -38,7 +40,7 @@ public interface {{className}} {
3840
/**
3941
* Json client service methods.
4042
*/
41-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
43+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
4244
final class Json {
4345
{{#allMethods}}
4446

@@ -83,10 +85,10 @@ public interface {{className}} {
8385
* @param request the {{inputType}} request message
8486
* @return a future of the {{outputType}} response message
8587
*/
86-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
88+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
8789
Future<{{outputType}}> {{vertxMethodName}}({{inputType}} request);
8890

89-
@io.vertx.codegen.annotations.GenIgnore
91+
@GenIgnore
9092
{{outputType}} {{vertxMethodName}}_sync({{inputType}} request);
9193
{{/unaryMethods}}
9294
{{#unaryManyMethods}}
@@ -97,10 +99,10 @@ public interface {{className}} {
9799
* @param request the {{inputType}} request message
98100
* @return a future of the {{outputType}} response messages
99101
*/
100-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
102+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
101103
Future<ReadStream<{{outputType}}>> {{vertxMethodName}}({{inputType}} request);
102104

103-
@io.vertx.codegen.annotations.GenIgnore
105+
@GenIgnore
104106
Stream<{{outputType}}> {{vertxMethodName}}_sync({{inputType}} request);
105107
{{/unaryManyMethods}}
106108
{{#manyUnaryMethods}}
@@ -111,7 +113,7 @@ public interface {{className}} {
111113
* @param completable a completable that will be passed a stream to which the {{inputType}} request messages can be written to.
112114
* @return a future of the {{outputType}} response message
113115
*/
114-
@io.vertx.codegen.annotations.GenIgnore
116+
@GenIgnore
115117
Future<{{outputType}}> {{vertxMethodName}}(Completable<WriteStream<{{inputType}}>> completable);
116118

117119
/**
@@ -120,7 +122,7 @@ public interface {{className}} {
120122
* @param streamOfMessages a stream of messages to be sent to the service
121123
* @return a future of the {{outputType}} response message
122124
*/
123-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
125+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
124126
Future<{{outputType}}> {{vertxMethodName}}(ReadStream<{{inputType}}> streamOfMessages);
125127

126128
/**
@@ -129,7 +131,7 @@ public interface {{className}} {
129131
* @param streamOfMessages a stream of messages to be sent to the service
130132
* @return a future of the {{outputType}} response message
131133
*/
132-
@io.vertx.codegen.annotations.GenIgnore
134+
@GenIgnore
133135
default {{outputType}} {{vertxMethodName}}_sync(java.util.List<{{inputType}}> streamOfMessages) {
134136
return {{vertxMethodName}}_sync(streamOfMessages.iterator());
135137
}
@@ -140,7 +142,7 @@ public interface {{className}} {
140142
* @param streamOfMessages a stream of messages to be sent to the service
141143
* @return a future of the {{outputType}} response message
142144
*/
143-
@io.vertx.codegen.annotations.GenIgnore
145+
@GenIgnore
144146
{{outputType}} {{vertxMethodName}}_sync(java.util.Iterator<{{inputType}}> streamOfMessages);
145147
{{/manyUnaryMethods}}
146148
{{#manyManyMethods}}
@@ -151,7 +153,7 @@ public interface {{className}} {
151153
* @param compltable a completable that will be passed a stream to which the {{inputType}} request messages can be written to.
152154
* @return a future of the {{outputType}} response messages
153155
*/
154-
@io.vertx.codegen.annotations.GenIgnore
156+
@GenIgnore
155157
Future<ReadStream<{{outputType}}>> {{vertxMethodName}}(Completable<WriteStream<{{inputType}}>> completable);
156158

157159
/**
@@ -160,7 +162,7 @@ public interface {{className}} {
160162
* @param streamOfMessages a stream of messages to be sent to the service
161163
* @return a future of the {{outputType}} response messages
162164
*/
163-
@io.vertx.codegen.annotations.GenIgnore(io.vertx.codegen.annotations.GenIgnore.PERMITTED_TYPE)
165+
@GenIgnore(GenIgnore.PERMITTED_TYPE)
164166
Future<ReadStream<{{outputType}}>> {{vertxMethodName}}(ReadStream<{{inputType}}> streamOfMessages);
165167
{{/manyManyMethods}}
166168
}

0 commit comments

Comments
 (0)