How to extend NotificationBroadcasterSupport and Observable

J

John

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
 
J

jan V

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top