Discussion:
Optional arguments to constructors
Geoff Little
2017-08-30 16:29:24 UTC
Permalink
Does this remain the recommended way to deal with Optional constructor
arguments?
Do you think it's bad idea?
Yeah, I don't think it pulls its weight. With the current solution,
you get to supply your own fallback value such as NoOpAirConditioner.
If we permitted optionality on a parameter-by-parameter basis, our
poor users would have to cope with null.
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/4d3812e1-9e44-445b-a93d-d46741a3aef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tavian Barnes
2017-08-30 18:14:34 UTC
Permalink
I'd recommend using OptionalBinder in modern Guice.
Post by Geoff Little
Does this remain the recommended way to deal with Optional constructor
arguments?
Do you think it's bad idea?
Yeah, I don't think it pulls its weight. With the current solution,
you get to supply your own fallback value such as NoOpAirConditioner.
If we permitted optionality on a parameter-by-parameter basis, our
poor users would have to cope with null.
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+***@googlegroups.com.
To post to this group, send email to google-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/735ab1e6-d54a-4871-9098-d74bfb59865f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...