Pattern, Abstract Factory / Factory

Luís Oliveira luismbo at gmail.com
Sat Feb 6 20:44:22 UTC 2021


On Sat, 6 Feb 2021 at 20:07, Rudi Araújo <rudi.araujo at gmail.com> wrote:
> Class::newInstance() doesn't have any parameters (also, it's deprecated: better to use getConstructor() or getDeclaredConstructor() and call newInstance() on it).

I guess this bit about getConstructor() explains why it'd be more
convenient to use a Factory, or the Factory method pattern, or some
dependency injection framework.


> Also, the generic agreement on your calls to makeAndPrint is failing.

Ah, <? extends Foo> was the key bit I was missing, thanks. :-)


On Sat, 6 Feb 2021 at 20:25, Rudi Araújo <rudi.araujo at gmail.com> wrote:
> The Stream API and lambdas make it almost pleasant to work with Java, but exception handling is still a bit tricky...

Yes, yes, almost. 🙄

Luís



More information about the pro mailing list