Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Interface with implied Constructor Date: Sat, 20 Jul 2013 17:32:09 -0400 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <925adeb1-65b5-4a50-86a8-4f04784f8da0@googlegroups.com> <1qbd0d9con02a.31vknk3c6iy$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 20 Jul 2013 21:26:04 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="0d73d8cc209bff1c6395088b400d0605"; logging-data="7943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sOKFkGLaNrJcT5ZaXl+m1" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <1qbd0d9con02a.31vknk3c6iy$.dlg@40tude.net> Cancel-Lock: sha1:PL+ztGYM9v5fUcRwUkpkFwuKHeU= Xref: csiph.com comp.lang.java.programmer:24786 On 7/20/2013 5:17 PM, Joerg Meier wrote: >[...] > While I have admittedly not followed the whole thread too closely, how > about this ? > > public interface Bla { > public void setBlurg(int newBlurg); > > public int getBlurg(); > > public Bla getInstance(int param, float difParam, Socket sockParam); > } > > No more need for Reflection to search for something. On the implementation > level, getInstance can still decide to discard unneccessary parameters. Since you already need an instance of a class implementing Bla before you can call getInstance() on it, what's the point? Perhaps you meant the interface to be BlaFactory (with getInstance() still returning Bla)? BlaFactory factory = BlaFactoryProvider.defaultFactory(); factory.setBlurg(86); Bla instance = factory.getInstance(42, 42.0, null); -- Eric Sosman esosman@comcast-dot-net.invalid