Scarlet icon indicating copy to clipboard operation
Scarlet copied to clipboard

Add scarlet.newBuilder()

Open orcchg opened this issue 3 years ago • 0 comments

By analogy to retrofit.newBuilder() that would inherit all properties from a given instance of Scarlet. This would be very useful.

Typical use case:

when Scarlet instance is configured in a sort of :core:network module and provided to :feature modules via DI (normally Dagger2). Then, for example, in some particular :feature we have it's own set of network model, so thus we would need to provide a Moshi-Adapter for them. But we don't want to expose these particular feature-related models globally to :core:network and others, but we still need to configure global Moshi there in :core:network.

If we have scarlet.newBuilder(), we then could extend base Scarlet instance from :core:network with our custom feature-oriented Moshi (we'd use moshi.newBuilder() here).

P.S. As a workaround for now, we have to expose Scarlet.Builder instance along with Scarlet instance from :core:network to customize configuration in :feature module.

orcchg avatar Mar 26 '21 11:03 orcchg