commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <>
Subject [lang] Notifier
Date Tue, 12 Nov 2002 03:07:40 GMT
I added Notifier class into Lang. I mentioned it a while back and thought
I'd place it in to share. I still need to write a threading test around it
to figure out exactly which methods need synchronising.

Basically it makes an event-listener queue a lot easier to handle:

    private Notifier notifier = new Notifier(MyListener.class);

    public void addMyListener(MyListener l) {

    public void removeMyListener(MyListener l) {

    public void foo() {

This version automatically figures out that MyListener has only 1 method
[for example]. If this is not the case, then the name of the method can be
set with setListenerMethod, or the name of the method may be passed in to
the notify method, allowing a Listener with multiple events to be handled.

Events must extend java.util.EventObject.



To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message