Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/beans/beancontext/BeanContextEvent.java
38918 views
/*1* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.beans.beancontext;2627import java.util.EventObject;2829import java.beans.beancontext.BeanContext;3031/**32* <p>33* <code>BeanContextEvent</code> is the abstract root event class34* for all events emitted35* from, and pertaining to the semantics of, a <code>BeanContext</code>.36* This class introduces a mechanism to allow the propagation of37* <code>BeanContextEvent</code> subclasses through a hierarchy of38* <code>BeanContext</code>s. The <code>setPropagatedFrom()</code>39* and <code>getPropagatedFrom()</code> methods allow a40* <code>BeanContext</code> to identify itself as the source41* of a propagated event.42* </p>43*44* @author Laurence P. G. Cable45* @since 1.246* @see java.beans.beancontext.BeanContext47*/4849public abstract class BeanContextEvent extends EventObject {50private static final long serialVersionUID = 7267998073569045052L;5152/**53* Contruct a BeanContextEvent54*55* @param bc The BeanContext source56*/57protected BeanContextEvent(BeanContext bc) {58super(bc);59}6061/**62* Gets the <code>BeanContext</code> associated with this event.63* @return the <code>BeanContext</code> associated with this event.64*/65public BeanContext getBeanContext() { return (BeanContext)getSource(); }6667/**68* Sets the <code>BeanContext</code> from which this event was propagated.69* @param bc the <code>BeanContext</code> from which this event70* was propagated71*/72public synchronized void setPropagatedFrom(BeanContext bc) {73propagatedFrom = bc;74}7576/**77* Gets the <code>BeanContext</code> from which this event was propagated.78* @return the <code>BeanContext</code> from which this79* event was propagated80*/81public synchronized BeanContext getPropagatedFrom() {82return propagatedFrom;83}8485/**86* Reports whether or not this event is87* propagated from some other <code>BeanContext</code>.88* @return <code>true</code> if propagated, <code>false</code>89* if not90*/91public synchronized boolean isPropagated() {92return propagatedFrom != null;93}9495/*96* fields97*/9899/**100* The <code>BeanContext</code> from which this event was propagated101*/102protected BeanContext propagatedFrom;103}104105106