[patch] java.beans.EventHandler
Bryce McKinlay
mckinlay@redhat.com
Fri Jul 16 21:01:00 GMT 2004
Jerry Quinn wrote:
>Bryce McKinlay writes:
> > Hmm. It seems to me that you can infer propertyType by looking up the
> > method for eventPropertyName and checking its return type? The return
> > type for the event property must be compatible with the argument for the
> > action, after all.
>
>Yes, but you don't yet know the class to look up eventPropertyName in when
>constructing the EventHandler.
>
The first argument to each listener method is the event. Is this not the
class to look up eventPropertyName in?
> Especially when directly calling the
>constructor. Even when using the create methods, let's say you create without
>providing listenerMethodName. This means that all listener methods are
>handled by using the first argument as the event. Each one could potentially
>be passed a different object type. Which do you use to acquire the Method
>object?
>
>
If the listener has multiple listener methods, we can look up each one
individually, although I think typically in a listener interface each
method will have the same argument type, so for efficiency its probably
best to remember past lookups and not repeat them again for multiple
methods.
> > Even though the chain can be heirarchical, the objects in the chain at
> > runtime must still be type compatible with the properties that were
> > passed into the create() method, right?
>
>Except that the properties are passed as Strings and not Classes or Methods.
>
>
I don't think this is a problem. Suppose eventPropertyName is "a.b.c".
First we look up "a", take the class of that, lookup "b" in that class,
etc... ?
Regards
Bryce
More information about the Java-patches
mailing list