avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [Review] Event Queues
Date Tue, 18 Dec 2001 14:08:18 GMT


> From: Berin Loritsch [mailto:bloritsch@apache.org]
> We could write the requirement that this happens, i.e.:
> 
> The Type returned MUST be unique to a given class so that
> 
> a.getType() == b.getType();
> 
> if
> 
> a.getClass().equals(b.getClass());
> 
> However, if the Classes for "a" and "b" are different classes
> (even if one is a subclass of the other), then a.getType != b.getType();

That would be perfect. All I want is to put it in writing that an EventHandler 
must be able to process events correctly just by looking at the class
of the event. (We could, of course, require all events to be final classes.)

When I wrote the ReflectionEventHandler I thought about 
someone writing something like this:

public class ConnectionEvent implements Signal {

    private final long type;

    public ConnectionEvent (long type) {
        this.type = type;
    }
   
    .
    .
    .

    public long getType () {
        return type;
    }
}

In order to avoid having to declare many classes. Since the ReflectionEventHandler
uses the type of the argument to lookup the handler function, and not the typeid,
this would make it dispatch incorrectly.


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message