jaroslav@601: /* jaroslav@601: * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. jaroslav@601: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@601: * jaroslav@601: * This code is free software; you can redistribute it and/or modify it jaroslav@601: * under the terms of the GNU General Public License version 2 only, as jaroslav@601: * published by the Free Software Foundation. Oracle designates this jaroslav@601: * particular file as subject to the "Classpath" exception as provided jaroslav@601: * by Oracle in the LICENSE file that accompanied this code. jaroslav@601: * jaroslav@601: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@601: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@601: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@601: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@601: * accompanied this code). jaroslav@601: * jaroslav@601: * You should have received a copy of the GNU General Public License version jaroslav@601: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@601: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@601: * jaroslav@601: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@601: * or visit www.oracle.com if you need additional information or have any jaroslav@601: * questions. jaroslav@601: */ jaroslav@601: jaroslav@601: package java.util; jaroslav@601: jaroslav@601: /** jaroslav@601: * An abstract wrapper class for an {@code EventListener} class jaroslav@601: * which associates a set of additional parameters with the listener. jaroslav@601: * Subclasses must provide the storage and accessor methods jaroslav@601: * for the additional arguments or parameters. jaroslav@601: *

jaroslav@601: * For example, a bean which supports named properties jaroslav@601: * would have a two argument method signature for adding jaroslav@601: * a {@code PropertyChangeListener} for a property: jaroslav@601: *

jaroslav@601:  * public void addPropertyChangeListener(String propertyName,
jaroslav@601:  *                                       PropertyChangeListener listener)
jaroslav@601:  * 
jaroslav@601: * If the bean also implemented the zero argument get listener method: jaroslav@601: *
jaroslav@601:  * public PropertyChangeListener[] getPropertyChangeListeners()
jaroslav@601:  * 
jaroslav@601: * then the array may contain inner {@code PropertyChangeListeners} jaroslav@601: * which are also {@code PropertyChangeListenerProxy} objects. jaroslav@601: *

jaroslav@601: * If the calling method is interested in retrieving the named property jaroslav@601: * then it would have to test the element to see if it is a proxy class. jaroslav@601: * jaroslav@601: * @since 1.4 jaroslav@601: */ jaroslav@601: public abstract class EventListenerProxy jaroslav@601: implements EventListener { jaroslav@601: jaroslav@601: private final T listener; jaroslav@601: jaroslav@601: /** jaroslav@601: * Creates a proxy for the specified listener. jaroslav@601: * jaroslav@601: * @param listener the listener object jaroslav@601: */ jaroslav@601: public EventListenerProxy(T listener) { jaroslav@601: this.listener = listener; jaroslav@601: } jaroslav@601: jaroslav@601: /** jaroslav@601: * Returns the listener associated with the proxy. jaroslav@601: * jaroslav@601: * @return the listener associated with the proxy jaroslav@601: */ jaroslav@601: public T getListener() { jaroslav@601: return this.listener; jaroslav@601: } jaroslav@601: }