Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #2961
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why only public methods on interfaces? |
| References | <25875c94-9af2-4d28-976d-2050a738ae2e@n10g2000yqf.googlegroups.com> |
| Message-ID | <uXsnp.2386$YL5.697@newsfe05.iad> (permalink) |
| Organization | Public Usenet Newsgroup Access |
| Date | 2011-04-07 21:48 -0300 |
On 11-04-07 09:09 PM, kramer31 wrote: > Could someone please explain to me the rational behind only allowing > public methods on interfaces? In my mind, protection and interfaces > are two independent if perhaps somewhat related concepts. > > For instance, I have an aspect which creates a proxy of a given > interface (which handles transaction propagation). Now in order to > use this aspect, I need an interface (otherwise, no proxy can be > created). However, I have some methods on this class which I would > like to proxy which are public, some are protected, some are package. > Because of this stupid restriction, I have to make all of the methods > public, or do ridiculous things with protection on inner classes. > > There are other examples, too. In fact one could imagine a case where > one would only want protected methods on an interface. > > Yuck, Java, yuck. I can't agree with your take on things here, with all due respect. To me that is what an interface is for - it's the set of public methods that you want an implementing object, including a proxy, to present to the rest of the world. And proxies in Java, by definition, implement a list of interfaces. That's what they are for. Maybe it's just me, but if I wanted an object that implemented public, protected and private methods, I'd construct an instance of a class that defines all those methods. Is there any reason you can't have a class that implements the transaction interface in question? AHS -- That's not the recollection that I recall...All this information is certainly in the hands of the auditor and we certainly await his report to indicate what he deems has occurred. -- Halifax, Nova Scotia mayor Peter Kelly, who is currently deeply in the shit
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Why only public methods on interfaces? kramer31 <kramer.newsreader@gmail.com> - 2011-04-07 17:09 -0700
Re: Why only public methods on interfaces? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-04-07 21:48 -0300
Re: Why only public methods on interfaces? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-07 21:01 -0400
Re: Why only public methods on interfaces? v_borchert@despammed.com (Volker Borchert) - 2011-04-08 02:43 +0000
Re: Why only public methods on interfaces? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-08 00:24 -0400
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-07 21:49 -0700
Re: Why only public methods on interfaces? Owen Jacobson <angrybaldguy@gmail.com> - 2011-04-08 01:01 -0400
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-07 22:37 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 00:14 -0700
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-08 06:59 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 07:17 -0700
Re: Why only public methods on interfaces? Patricia Shanahan <pats@acm.org> - 2011-04-08 08:59 -0700
Re: Why only public methods on interfaces? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-04-08 17:27 -0700
Re: Why only public methods on interfaces? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-04-09 22:14 -0700
Re: Why only public methods on interfaces? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-04-09 22:28 -0700
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-10 16:02 +0100
Re: Why only public methods on interfaces? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-08 03:18 -0700
Re: Why only public methods on interfaces? Esmond Pitt <esmond.pitt@bigpond.com> - 2011-04-08 20:32 +1000
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-08 20:34 +0100
Re: Why only public methods on interfaces? Tom Anderson <twic@urchin.earth.li> - 2011-04-10 18:10 +0100
csiph-web