You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/generators/java.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
104
104
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.||false|
105
105
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.||false|
106
106
|useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.||false|
107
+
|useUnaryInterceptor|Specify if the ResponseInterceptor should be able to change the request before beeing returned||false|
107
108
|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.||false|
108
109
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync||false|
109
110
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)||false|
cliOptions.add(CliOption.newBoolean(FAIL_ON_UNKNOWN_PROPERTIES, "Fail Jackson de-serialization on unknown properties", this.failOnUnknownProperties));
261
263
cliOptions.add(CliOption.newBoolean(SUPPORT_VERTX_FUTURE, "Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.", this.supportVertxFuture));
262
264
cliOptions.add(CliOption.newBoolean(USE_SEALED_ONE_OF_INTERFACES, "Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient and RestClient.", this.useSealedOneOfInterfaces));
265
+
cliOptions.add(CliOption.newBoolean(USE_UNARY_INTERCEPTOR, "If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption", this.useUnaryInterceptor));
263
266
264
267
supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1");
265
268
supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1");
* <p>This is useful for logging, monitoring or extraction of header variables</p>
364
-
*
371
+
* <p>If you are using the UnaryInterceptor you can even manipulate the response to a certain degree</p>
365
372
* @param interceptor A function invoked before creating each request. A value
366
373
* of null resets the interceptor to a no-op.
367
374
* @return This object.
368
375
*/
369
-
public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) {
376
+
public ApiClient setResponseInterceptor({{#useUnaryInterceptor}}UnaryOperator{{/useUnaryInterceptor}}{{^useUnaryInterceptor}}Consumer{{/useUnaryInterceptor}}<HttpResponse<InputStream>> interceptor) {
370
377
this.responseInterceptor = interceptor;
371
378
return this;
372
379
}
@@ -376,20 +383,20 @@ public class ApiClient {
376
383
*
377
384
* @return The custom interceptor that was set, or null if there isn't any.
378
385
*/
379
-
public Consumer<HttpResponse<InputStream>> getResponseInterceptor() {
386
+
public {{#useUnaryInterceptor}}UnaryOperator{{/useUnaryInterceptor}}{{^useUnaryInterceptor}}Consumer{{/useUnaryInterceptor}}<HttpResponse<InputStream>> getResponseInterceptor() {
380
387
return responseInterceptor;
381
388
}
382
389
383
390
/**
384
391
* Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'.
385
392
*
386
393
* <p>This is useful for logging, monitoring or extraction of header variables</p>
387
-
*
394
+
* <p>If you are using the UnaryInterceptor you can even manipulate the response to a certain degree</p>
388
395
* @param interceptor A function invoked before creating each request. A value
389
396
* of null resets the interceptor to a no-op.
390
397
* @return This object.
391
398
*/
392
-
public ApiClient setAsyncResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) {
399
+
public ApiClient setAsyncResponseInterceptor({{#useUnaryInterceptor}}UnaryOperator{{/useUnaryInterceptor}}{{^useUnaryInterceptor}}Consumer{{/useUnaryInterceptor}}<HttpResponse<InputStream>> interceptor) {
393
400
this.asyncResponseInterceptor = interceptor;
394
401
return this;
395
402
}
@@ -399,7 +406,7 @@ public class ApiClient {
399
406
*
400
407
* @return The custom interceptor that was set, or null if there isn't any.
401
408
*/
402
-
public Consumer<HttpResponse<InputStream>> getAsyncResponseInterceptor() {
409
+
public {{#useUnaryInterceptor}}UnaryOperator{{/useUnaryInterceptor}}{{^useUnaryInterceptor}}Consumer{{/useUnaryInterceptor}}<HttpResponse<InputStream>> getAsyncResponseInterceptor() {
0 commit comments