This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] java.beans.EventHandler


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]