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
Component.Factory is a much simpler way to create a component than the builder pattern. THere's a lot less boilerplate code, plus it mostly forces you into having no arg constructors for your modules, which is a good thing.
However, i'm not seeing a way to provide a way to call the factory class. In addition, our factories generally have a bindsInstance parameter. It would be nice to have a way to customize the entire component creation process, not just via the builder pattern.
The text was updated successfully, but these errors were encountered:
As a side note, i also don't think Component.Builder works with dagggermock either if you don't have a builder function for each individual module. From looking at it, the generated builder class creates the no arg versions of the modules automatically. As such, you can't really pass them to dagger mock to work with the overrider, since there is no function to set the module. So while you can have i create a component and customize parts of the builder for the bindsInstance, you can't use the provides functions to override objects in the graph.
@Component.Builder
interface Builder {
@BindsInstance fun context(context: Context): Builder
fun build(): MyComponent
Is that a fair assessment?
The reason i ask is that i'm trying to use anvil, so having to enumerate the modules in the builder seems wrong, since they are dynamically collected at compile time.
Component.Factory is a much simpler way to create a component than the builder pattern. THere's a lot less boilerplate code, plus it mostly forces you into having no arg constructors for your modules, which is a good thing.
However, i'm not seeing a way to provide a way to call the factory class. In addition, our factories generally have a bindsInstance parameter. It would be nice to have a way to customize the entire component creation process, not just via the builder pattern.
The text was updated successfully, but these errors were encountered: