Skip to content
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

Update Mapper generation to use factories #156

Merged

Conversation

sav007
Copy link
Contributor

@sav007 sav007 commented Feb 4, 2017

Sorry for such big PR but that because changes touch all test fixtures.

PR changes the way how ResponseFieldMapper been generated to accept factory to instantiate the models.

This class FragmentsResponseMapperBuilder responsible for Mapper generation of Fragments class
This class SchemaTypeResponseMapperBuilder responsible for Mapper generation for the rest schema object types.

Example of generated class with mappers

Example how to register Mapper in retrofit converter for POJO classes

Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(server.url("/"))
        .addConverterFactory(new ApolloConverterFactory.Builder()
            .withResponseFieldMapper(AllPlanets.Data.class, new AllPlanets.Data.Mapper(AllPlanets.Data.FACTORY))
            .withResponseFieldMapper(ProductsWithDate.Data.class, new ProductsWithDate.Data.Mapper(ProductsWithDate
                .Data.FACTORY))

Closes #142

Copy link
Contributor

@digitalbuddha digitalbuddha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sav007 sav007 changed the title [WIP] Update Mapper generation to use factories Update Mapper generation to use factories Feb 5, 2017
@sav007 sav007 merged commit 297abf6 into apollographql:master Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ResponseFieldMapper generation to use Factory
2 participants