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
This is intended as a step towards simplifying Feign.
This changeset removes the generics from both interfaces, and changes their
Dagger bindings from SET to UNIQUE.
Additionally, in changing the signatures for Encoder/Decoder, it focuses on use
of the RequestTemplate and Response objects, allowing us to extend them
in the future to support binary data without needing to change the
Encoder/Decoder signatures again.
Copy file name to clipboardExpand all lines: README.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ You can find [several examples](https://github.com/Netflix/feign/tree/master/fei
73
73
### Integrations
74
74
Feign intends to work well within Netflix and other Open Source communities. Modules are welcome to integrate with your favorite projects!
75
75
### Gson
76
-
[GsonModule](https://github.com/Netflix/feign/tree/master/feign-gson) adds default encoders and decoders so you get get started with a json api.
76
+
[GsonModule](https://github.com/Netflix/feign/tree/master/feign-gson) adds default encoders and decoders so you get get started with a JSON api.
77
77
78
78
Integration requires you pass `new GsonModule()` to `Feign.create()`, or add it to your graph with Dagger:
79
79
```java
@@ -101,46 +101,46 @@ MyService api = Feign.create(MyService.class, "https://myAppProd", new RibbonMod
101
101
### Decoders
102
102
The last argument to `Feign.create` allows you to specify additional configuration such as how to decode a responses, modeled in Dagger.
103
103
104
-
If any methods in your interface return types besides `void` or `String`, you'll need to configure a `Decoder.TextStream<T>` or a general one for all types (`Decoder.TextStream<Object>`).
104
+
If any methods in your interface return types besides `Response`, `void` or `String`, you'll need to configure a `Decoder`.
105
105
106
-
The `GsonModule` in the `feign-gson` extension configures a (`Decoder.TextStream<Object>`) which parses objects from json using reflection.
106
+
The `GsonModule` in the `feign-gson` extension configures a `Decoder` which parses objects from JSON using reflection.
107
107
108
108
Here's how you could write this yourself, using whatever library you prefer:
The generic parameter of `Decoder.TextStream<T>` designates which The type parameter is either a concrete type, or `Object`, if your decoder can handle multiple types. To add a type-specific decoder, ensure your type parameter is correct. Here's an example of an xml decoder that will only apply to methods that return `ZoneList`.
Feign can be directly wired into Dagger which keeps things at compile time and Android friendly. As opposed to exposing builders for config, Feign intends users to embed their config in Dagger.
135
127
136
-
Where possible, Feign configuration uses normal Dagger conventions. For example, `Decoder` bindings are of `Provider.Type.SET`, meaning you can make multiple bindings for all the different types you return. Here's an example of multiple decoder bindings.
128
+
Where possible, Feign configuration uses normal Dagger conventions. For example, `RequestInterceptor` bindings are of `Provider.Type.SET`, meaning you can have multiple interceptors. Here's an example of multiple interceptor bindings.
0 commit comments