From: Garcia, M. <mg...@Bu...> - 2001-01-09 00:11:33
|
Thanks for your advice. For my purposes (writing an EJB test client) I think I'll just leave the respectJavaAccessibility to false even though this may not be the preferred technique. In the future I'll try to keep the setting to true by using this technique. Can I find any documentation at SourceForge pertaining to Jython's handling of private and protected members? thanks again. sincerely, Michael -----Original Message----- From: Robert W. Bill To: jyt...@li... Cc: Garcia, Michael Sent: 1/8/01 6:53 PM Subject: Re: [Jython-dev] Re: Problem calling protected method [Adam Burke] > You are very much on the right track. > > This is an FAQ: <snip> > > If you want to leave respectJavaAccessibility = true, could you inherit > from java.util.Calendar and expose the functionality that way? It may > require adding a public method that simply does > return self.x() Or use the lazy way, avoid the abstract class, and inherit from GregorianCalendar, i.e.- >>>from java.util import GregorianCalendar >>>class myTime(GregorianCalendar): ... def ms(self): ... return self.getTimeInMillis() ... >>>t = test() >>>t.ms() 978997877490L >>> If you still have respectJavaAccessibility = true, you can confirm protected status with: >>>g = GregorianCalendar() >>>g.getTimeInMillis() Traceback (innermost last): File "<console>", line 1, in ? AttributeError: getTimeInMillis (I actually sent this earlier, but received an service unavailable error- I apologize if I'm repeating myself...again :) cheers, -Robert |