LOL! Wunnerful! And I agree. > -----Original Message----- > From: Josh McDonald [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 16, 2006 7:04 PM > To: user@struts.apache.org > Subject: Re: [OT] Hiding methods > > > Strewth! I just went back and read this thread... Throw an > exception and check to see if you like the caller???? That > makes baby jesus cry. > > If you have public methods you don't want people to call, ask > them not to. If doing what you ask them not to causes > exceptions and their program not to work, then the problem > seems to be solved already. > > And if you insist on keeping a list of classes that can call > your api and checking it santa-style, then don't do it on > every method call, that's just plain horrible. Make those > methods "package", and add a proxy class in that package with > public a API that can only be instantiated by your "manager" > classes. And it's you're still going to go to programmer hell > if you do that. > > -Josh > > -- > > "His comrades fought beside him, Van Owen and the rest... > But of all the thompson gunners- Roland was the best." > > Josh McDonald > Analyst Programmer > Information Technology > Ph: 61 7 3006 6460 > Email: [EMAIL PROTECTED] > > > >>> [EMAIL PROTECTED] 17/02/2006 9:29:18 am >>> > > Frank W. Zammetti wrote: > > I saw a very similar question asked a few months back in a general > Java > > forum, and I suggested an answer that I've never had the chance to > > actually try out... the theory is interesting though... > > > > In the method you want to "protect", immediately throw an exception > and > > catch it. Then, parse the stack trace and see who the caller was. > If > > it's not a class you want to have access to the method, throw an > > IllegalAccessException. > > > > Again, it's one of those things that sounds good in your > head, I have > no > > idea if it translates to anything workable :) > > Ewwww! If you're going to reinvent the wheel, at least don't make it > square ;-) > > L. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > ************************************************************** > ************* > Messages included in this e-mail and any of its attachments > are those of the author unless specifically stated to > represent WorkCover Queensland. The contents of this message > are to be used for the intended purpose only and are to be > kept confidential at all times. This message may contain > privileged information directed only to the intended > addressee/s. Accidental receipt of this information should be > deleted promptly and the sender notified. This e-mail has > been scanned by Sophos for known viruses. However, no > warranty nor liability is implied in this respect. > ************************************************************** > ************** > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]