1. /*
  2. * @(#)EventListenerProxy.java 1.5 04/01/12
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.util;
  8. /**
  9. * An abstract wrapper class for an EventListener class which associates a set
  10. * of additional parameters with the listener. Subclasses must provide the
  11. * storage and accessor methods for the additional arguments or parameters.
  12. *
  13. * Subclasses of EventListenerProxy may be returned by getListeners() methods
  14. * as a way of associating named properties with their listeners.
  15. *
  16. * For example, a Bean which supports named properties would have a two
  17. * argument method signature for adding a PropertyChangeListener for a
  18. * property:
  19. *
  20. * public void addPropertyChangeListener(String propertyName,
  21. * PropertyChangeListener listener);
  22. *
  23. * If the Bean also implemented the zero argument get listener method:
  24. *
  25. * public PropertyChangeListener[] getPropertyChangeListeners();
  26. *
  27. * then the array may contain inner PropertyChangeListeners which are also
  28. * PropertyChangeListenerProxy objects.
  29. *
  30. * If the calling method is interested in retrieving the named property then it
  31. * would have to test the element to see if it is a proxy class.
  32. *
  33. * @since 1.4
  34. */
  35. public abstract class EventListenerProxy implements EventListener {
  36. private final EventListener listener;
  37. /**
  38. * @param listener The listener object.
  39. */
  40. public EventListenerProxy(EventListener listener) {
  41. this.listener = listener;
  42. }
  43. /**
  44. * @return The listener associated with this proxy.
  45. */
  46. public EventListener getListener() {
  47. return listener;
  48. }
  49. }