Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2005

Tip: Looking for answers? Try searching our database.

How to extend NotificationBroadcasterSupport  and Observable

Thread view: 
John - 12 Aug 2005 18:48 GMT
Hi,

I know this is a stupid question, but I have a lot of classes in my app
that use Observable to publish messages for other classes in the app.

I now need to go in and make many of these classes able to publish
notifications via MBeans.

Is there a standard way to do this? I know I can't extend two classes.
What do smart people do in this situation?

THANKS!
John
jan V - 12 Aug 2005 18:57 GMT
> Is there a standard way to do this? I know I can't extend two classes.
> What do smart people do in this situation?

Subclassing is dangerous, as you're finding out. You should only subclass
when *absolutely* necessary, e.g. to create a GUI component that will be
compatible with the Swing framework.

I use a little naming rule which says that anything named -able (like
Observable) should be an interface. Runnable, Serializable, Comparable...
all clearly define attributes for would-be implementations. So Observable
should have been an interface.

Is there any way you could systematically break the subclass link and use
Observable as objects to delegate to, within your current Observable
subclasses? If so, I'd start editing...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.