author | darcy |
Tue, 24 Sep 2019 18:25:54 -0700 | |
changeset 58309 | c6f8b2c3dc66 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.beans.beancontext; |
|
27 |
||
28 |
import java.util.EventObject; |
|
29 |
||
30 |
import java.beans.beancontext.BeanContext; |
|
31 |
||
32 |
/** |
|
33 |
* <p> |
|
35667 | 34 |
* {@code BeanContextEvent} is the abstract root event class |
2 | 35 |
* for all events emitted |
35667 | 36 |
* from, and pertaining to the semantics of, a {@code BeanContext}. |
2 | 37 |
* This class introduces a mechanism to allow the propagation of |
35667 | 38 |
* {@code BeanContextEvent} subclasses through a hierarchy of |
39 |
* {@code BeanContext}s. The {@code setPropagatedFrom()} |
|
40 |
* and {@code getPropagatedFrom()} methods allow a |
|
41 |
* {@code BeanContext} to identify itself as the source |
|
2 | 42 |
* of a propagated event. |
43 |
* </p> |
|
44 |
* |
|
45 |
* @author Laurence P. G. Cable |
|
46 |
* @since 1.2 |
|
47 |
* @see java.beans.beancontext.BeanContext |
|
48 |
*/ |
|
49 |
||
50 |
public abstract class BeanContextEvent extends EventObject { |
|
2482
77898184e343
4769844: classes in java.beans that are serializable but don't define serialVersionUID
malenkov
parents:
2
diff
changeset
|
51 |
private static final long serialVersionUID = 7267998073569045052L; |
2 | 52 |
|
53 |
/** |
|
54 |
* Contruct a BeanContextEvent |
|
55 |
* |
|
56 |
* @param bc The BeanContext source |
|
57 |
*/ |
|
58 |
protected BeanContextEvent(BeanContext bc) { |
|
59 |
super(bc); |
|
60 |
} |
|
61 |
||
62 |
/** |
|
35667 | 63 |
* Gets the {@code BeanContext} associated with this event. |
64 |
* @return the {@code BeanContext} associated with this event. |
|
2 | 65 |
*/ |
66 |
public BeanContext getBeanContext() { return (BeanContext)getSource(); } |
|
67 |
||
68 |
/** |
|
35667 | 69 |
* Sets the {@code BeanContext} from which this event was propagated. |
70 |
* @param bc the {@code BeanContext} from which this event |
|
2 | 71 |
* was propagated |
72 |
*/ |
|
73 |
public synchronized void setPropagatedFrom(BeanContext bc) { |
|
74 |
propagatedFrom = bc; |
|
75 |
} |
|
76 |
||
77 |
/** |
|
35667 | 78 |
* Gets the {@code BeanContext} from which this event was propagated. |
79 |
* @return the {@code BeanContext} from which this |
|
2 | 80 |
* event was propagated |
81 |
*/ |
|
82 |
public synchronized BeanContext getPropagatedFrom() { |
|
83 |
return propagatedFrom; |
|
84 |
} |
|
85 |
||
86 |
/** |
|
87 |
* Reports whether or not this event is |
|
35667 | 88 |
* propagated from some other {@code BeanContext}. |
89 |
* @return {@code true} if propagated, {@code false} |
|
2 | 90 |
* if not |
91 |
*/ |
|
92 |
public synchronized boolean isPropagated() { |
|
93 |
return propagatedFrom != null; |
|
94 |
} |
|
95 |
||
96 |
/* |
|
97 |
* fields |
|
98 |
*/ |
|
99 |
||
100 |
/** |
|
35667 | 101 |
* The {@code BeanContext} from which this event was propagated |
2 | 102 |
*/ |
58309
c6f8b2c3dc66
8231334: Suppress warnings on non-serializable instance fields in client libs serializable classes
darcy
parents:
47216
diff
changeset
|
103 |
@SuppressWarnings("serial") // Not statically typed as Serializable |
2 | 104 |
protected BeanContext propagatedFrom; |
105 |
} |