Join Slack
Powered by
If I have a constructor with default values how ca...
# dagger
w
william
12/12/2018, 1:11 AM
If I have a constructor with default values how can I make it so dagger doesn't try and inject those fields?
g
gildor
12/12/2018, 2:12 AM
you cannot do this
gildor
12/12/2018, 2:13 AM
Just create secondary constructor with only required values and annotate this constructor with @Inject annotation
w
william
12/12/2018, 2:14 AM
hmm ok thanks
g
gildor
12/12/2018, 2:16 AM
so this secondary constructor will delegate to primary and default field values will be used
t
tevjef
12/12/2018, 5:07 AM
also maybe:
https://github.com/square/AssistedInject
g
gildor
12/12/2018, 5:15 AM
AssistedInject will not help with default arguments it has different use case
➕ 3
12
Views
Open in Slack
Previous
Next