Skip to content

provide encoder/decoder in a module that addsTo = Feign.Defaults.class - #68

Merged
codefromthecrypt merged 1 commit into
masterfrom
clean-dagger
Sep 16, 2013
Merged

codefromthecrypt merged 1 commit into
masterfrom
clean-dagger

Conversation

@codefromthecrypt

Copy link
Copy Markdown

This clarifies that Feign.Defaults contains everything needed except an Encoder and a Decoder.

In order to complete the graph, you'll want to

  1. use Feign.builder() and specify .decoder() and encoder()
  2. include or specify a codec module Feign.create(GitHub.class, "https://api.github.com", new GsonModule()).
  3. create your own module and add @Provides methods for codec.
@dagger.Module(addsTo = Feign.Defaults.class)
static class Dependencies {
  @Provides Decoder defaultDecoder() {
    return // my custom
  }

  @Provides Encoder defaultEncoder() {
    return // my custom
  }
}

@codefromthecrypt

Copy link
Copy Markdown
Author

@davidmc24 please take a look. I think this clears things up..

@codefromthecrypt

Copy link
Copy Markdown
Author

whoops junk in my commit PTAL

@cloudbees-pull-request-builder

Copy link
Copy Markdown

feign-pull-requests #89 SUCCESS
This pull request looks good

@davidmc24

Copy link
Copy Markdown
Contributor

Code changes look good. Maybe add a entry to the changelog:

  • Feign.create(...) now requires specifying an encoder and decoder

My first pass at the builder API had been using a form more similar to what Hystrix uses for Setter objects. Something like Feign.withTarget(Bank.class, "https://my.bank.com").andEncoder(encoder).build(). Since it's using the names of the fields as the setters, it makes sense to merge the builder and the module as you did. Thanks for the enhancement.

@codefromthecrypt

Copy link
Copy Markdown
Author

thx for the changelog suggestion + the history on the builder design! fyi I'll be offline almost all today again and only other change pending from me is the SAX thing.

codefromthecrypt pushed a commit that referenced this pull request Sep 16, 2013
provide encoder/decoder in a module that addsTo = Feign.Defaults.class
@codefromthecrypt
codefromthecrypt merged commit 7487f80 into master Sep 16, 2013
@codefromthecrypt
codefromthecrypt deleted the clean-dagger branch September 16, 2013 06:15
@cloudbees-pull-request-builder

Copy link
Copy Markdown

feign-pull-requests #90 SUCCESS
This pull request looks good

velo pushed a commit that referenced this pull request Oct 8, 2024
provide encoder/decoder in a module that addsTo = Feign.Defaults.class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants