New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify decorator builder methods #1484
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trustin
force-pushed
the
cleaner_decorator_api
branch
2 times, most recently
from
December 7, 2018 03:13
499ee3a
to
df141b7
Compare
Motivation: Practically, there are only 2 ways of adding a client decorator: - `builder.decorator(HttpRequest.class, HttpResposne.class, ...);` - `builder.decorator(RpcRequest.class, RpcResponse.class, ...);` Instead of requiring a user to specify req/res types, we could just provide two builder methods dedicated to each case. Modifications: - Deprecated the old `decorator()` builder methods. - Added `decorator(Function)` and `decorator(ClientDecoratorFunction)` which adds an HTTP-level decorator. - Added `rpcDecorator(Function)` and `rpcDecorator(ClientDecoratorFunction)` which adds an RPC-level decorator. - Removed `HttpClient.decorator()` methods which became unnecessary due to the new `decorator()` methods in `AbstractClientOptionsBuilder`. Result: - Fixes line#1482 - Simpler builder API - Leaner user code
trustin
force-pushed
the
cleaner_decorator_api
branch
from
December 7, 2018 04:18
df141b7
to
0221896
Compare
hyangtack
approved these changes
Dec 7, 2018
Codecov Report
@@ Coverage Diff @@
## master #1484 +/- ##
============================================
+ Coverage 72.17% 72.18% +0.01%
- Complexity 6648 6657 +9
============================================
Files 637 637
Lines 27575 27591 +16
Branches 3319 3319
============================================
+ Hits 19901 19916 +15
- Misses 5924 5928 +4
+ Partials 1750 1747 -3
Continue to review full report at Codecov.
|
anuraaga
approved these changes
Dec 7, 2018
minwoox
approved these changes
Dec 11, 2018
fmguerreiro
pushed a commit
to fmguerreiro/armeria
that referenced
this pull request
Sep 19, 2020
Motivation: Practically, there are only 2 ways of adding a client decorator: - `builder.decorator(HttpRequest.class, HttpResposne.class, ...);` - `builder.decorator(RpcRequest.class, RpcResponse.class, ...);` Instead of requiring a user to specify req/res types, we could just provide two builder methods dedicated to each case. Modifications: - Deprecated the old `decorator()` builder methods. - Added `decorator(Function)` and `decorator(ClientDecoratorFunction)` which adds an HTTP-level decorator. - Added `rpcDecorator(Function)` and `rpcDecorator(ClientDecoratorFunction)` which adds an RPC-level decorator. - Removed `HttpClient.decorator()` methods which became unnecessary due to the new `decorator()` methods in `AbstractClientOptionsBuilder`. Result: - Fixes line#1482 - Simpler builder API - Leaner user code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Practically, there are only 2 ways of adding a client decorator:
builder.decorator(HttpRequest.class, HttpResposne.class, ...);
builder.decorator(RpcRequest.class, RpcResponse.class, ...);
Instead of requiring a user to specify req/res types, we could just
provide two builder methods dedicated to each case.
Modifications:
decorator()
builder methods.decorator(Function)
anddecorator(ClientDecoratorFunction)
which add an HTTP-level decorator.
rpcDecorator(Function)
andrpcDecorator(ClientDecoratorFunction)
which add an RPC-level decorator.
HttpClient.decorator()
methods which became unnecessary dueto the new
decorator()
methods inAbstractClientOptionsBuilder
.Result:
decorator(Function)
andrpcDecorator(Function)
toAbstractClientOptionsBuilder
#1482