/[classpath]/classpath/java/beans/EventHandler.java
ViewVC logotype

Diff of /classpath/java/beans/EventHandler.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mkoch, Sat Jul 17 07:24:26 2004 UTC revision 1.1.2.1 by tromey, Sun Oct 10 00:04:38 2004 UTC
# Line 301  public class EventHandler implements Inv Line 301  public class EventHandler implements Inv
301     * @param action Target property or method to invoke.     * @param action Target property or method to invoke.
302     * @return A constructed proxy object.     * @return A constructed proxy object.
303     */     */
304    public static Object create(Class listenerInterface, Object target, String action)    public static <T> T create(Class<T> listenerInterface, Object target,
305                                 String action)
306    {    {
307      return create(listenerInterface, target, action, null, null);      return create(listenerInterface, target, action, null, null);
308    }    }
# Line 322  public class EventHandler implements Inv Line 323  public class EventHandler implements Inv
323     * @param eventPropertyName Name of property to extract from event.     * @param eventPropertyName Name of property to extract from event.
324     * @return A constructed proxy object.     * @return A constructed proxy object.
325     */     */
326    public static Object create(Class listenerInterface, Object target,    public static <T> T create(Class<T> listenerInterface, Object target,
327                                String action, String eventPropertyName)                               String action, String eventPropertyName)
328    {    {
329      return create(listenerInterface, target, action, eventPropertyName, null);      return create(listenerInterface, target, action, eventPropertyName, null);
330    }    }
# Line 371  public class EventHandler implements Inv Line 372  public class EventHandler implements Inv
372     * @param listenerMethodName Listener method to implement.     * @param listenerMethodName Listener method to implement.
373     * @return A constructed proxy object.     * @return A constructed proxy object.
374     */     */
375    public static Object create(Class listenerInterface, Object target,    public static <T> T create(Class<T> listenerInterface, Object target,
376                                String action, String eventPropertyName,                               String action, String eventPropertyName,
377                                String listenerMethodName)                               String listenerMethodName)
378    {    {
379      // Create EventHandler instance      // Create EventHandler instance
380      EventHandler eh = new EventHandler(target, action, eventPropertyName,      EventHandler eh = new EventHandler(target, action, eventPropertyName,
# Line 381  public class EventHandler implements Inv Line 382  public class EventHandler implements Inv
382    
383      // Create proxy object passing in the event handler      // Create proxy object passing in the event handler
384      Object proxy = Proxy.newProxyInstance(listenerInterface.getClassLoader(),      Object proxy = Proxy.newProxyInstance(listenerInterface.getClassLoader(),
385                                            new Class[] {listenerInterface},                                            new Class<?>[] {listenerInterface},
386                                            eh);                                            eh);
387    
388      return proxy;      return (T) proxy;
389    }    }
   
390  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26