Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/java/beans/beancontext/BeanContextEvent.java
41159 views
1
/*
2
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
24
*/
25
26
package java.beans.beancontext;
27
28
import java.io.Serial;
29
import java.util.EventObject;
30
31
/**
32
* <p>
33
* {@code BeanContextEvent} is the abstract root event class
34
* for all events emitted
35
* from, and pertaining to the semantics of, a {@code BeanContext}.
36
* This class introduces a mechanism to allow the propagation of
37
* {@code BeanContextEvent} subclasses through a hierarchy of
38
* {@code BeanContext}s. The {@code setPropagatedFrom()}
39
* and {@code getPropagatedFrom()} methods allow a
40
* {@code BeanContext} to identify itself as the source
41
* of a propagated event.
42
* </p>
43
*
44
* @author Laurence P. G. Cable
45
* @since 1.2
46
* @see java.beans.beancontext.BeanContext
47
*/
48
49
public abstract class BeanContextEvent extends EventObject {
50
51
/**
52
* Use serialVersionUID from JDK 1.7 for interoperability.
53
*/
54
@Serial
55
private static final long serialVersionUID = 7267998073569045052L;
56
57
/**
58
* Contruct a BeanContextEvent
59
*
60
* @param bc The BeanContext source
61
*/
62
protected BeanContextEvent(BeanContext bc) {
63
super(bc);
64
}
65
66
/**
67
* Gets the {@code BeanContext} associated with this event.
68
* @return the {@code BeanContext} associated with this event.
69
*/
70
public BeanContext getBeanContext() { return (BeanContext)getSource(); }
71
72
/**
73
* Sets the {@code BeanContext} from which this event was propagated.
74
* @param bc the {@code BeanContext} from which this event
75
* was propagated
76
*/
77
public synchronized void setPropagatedFrom(BeanContext bc) {
78
propagatedFrom = bc;
79
}
80
81
/**
82
* Gets the {@code BeanContext} from which this event was propagated.
83
* @return the {@code BeanContext} from which this
84
* event was propagated
85
*/
86
public synchronized BeanContext getPropagatedFrom() {
87
return propagatedFrom;
88
}
89
90
/**
91
* Reports whether or not this event is
92
* propagated from some other {@code BeanContext}.
93
* @return {@code true} if propagated, {@code false}
94
* if not
95
*/
96
public synchronized boolean isPropagated() {
97
return propagatedFrom != null;
98
}
99
100
/*
101
* fields
102
*/
103
104
/**
105
* The {@code BeanContext} from which this event was propagated
106
*/
107
@SuppressWarnings("serial") // Not statically typed as Serializable
108
protected BeanContext propagatedFrom;
109
}
110
111