Moving modules around so the runtime is under one master pom and can be built without building other modules that are in the repository
2 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
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
29 * A "PropertyChange" event gets delivered whenever a bean changes a "bound"
30 * or "constrained" property. A PropertyChangeEvent object is sent as an
31 * argument to the PropertyChangeListener and VetoableChangeListener methods.
33 * Normally PropertyChangeEvents are accompanied by the name and the old
34 * and new value of the changed property. If the new value is a primitive
35 * type (such as int or boolean) it must be wrapped as the
36 * corresponding java.lang.* Object type (such as Integer or Boolean).
38 * Null values may be provided for the old and the new values if their
39 * true values are not known.
41 * An event source may send a null object as the name to indicate that an
42 * arbitrary set of if its properties have changed. In this case the
43 * old and new values should also be null.
46 public class PropertyChangeEvent extends java.util.EventObject {
47 private static final long serialVersionUID = 7042693688939648123L;
50 * Constructs a new <code>PropertyChangeEvent</code>.
52 * @param source The bean that fired the event.
53 * @param propertyName The programmatic name of the property
55 * @param oldValue The old value of the property.
56 * @param newValue The new value of the property.
58 public PropertyChangeEvent(Object source, String propertyName,
59 Object oldValue, Object newValue) {
61 this.propertyName = propertyName;
62 this.newValue = newValue;
63 this.oldValue = oldValue;
67 * Gets the programmatic name of the property that was changed.
69 * @return The programmatic name of the property that was changed.
70 * May be null if multiple properties have changed.
72 public String getPropertyName() {
77 * Gets the new value for the property, expressed as an Object.
79 * @return The new value for the property, expressed as an Object.
80 * May be null if multiple properties have changed.
82 public Object getNewValue() {
87 * Gets the old value for the property, expressed as an Object.
89 * @return The old value for the property, expressed as an Object.
90 * May be null if multiple properties have changed.
92 public Object getOldValue() {
97 * Sets the propagationId object for the event.
99 * @param propagationId The propagationId object for the event.
101 public void setPropagationId(Object propagationId) {
102 this.propagationId = propagationId;
106 * The "propagationId" field is reserved for future use. In Beans 1.0
107 * the sole requirement is that if a listener catches a PropertyChangeEvent
108 * and then fires a PropertyChangeEvent of its own, then it should
109 * make sure that it propagates the propagationId field from its
110 * incoming event to its outgoing event.
112 * @return the propagationId object associated with a bound/constrained
115 public Object getPropagationId() {
116 return propagationId;
120 * name of the property that changed. May be null, if not known.
123 private String propertyName;
126 * New value for property. May be null if not known.
129 private Object newValue;
132 * Previous value for property. May be null if not known.
135 private Object oldValue;
138 * Propagation ID. May be null.
140 * @see #getPropagationId
142 private Object propagationId;
145 * Returns a string representation of the object.
147 * @return a string representation of the object
151 public String toString() {
152 StringBuilder sb = new StringBuilder(getClass().getName());
153 sb.append("[propertyName=").append(getPropertyName());
155 sb.append("; oldValue=").append(getOldValue());
156 sb.append("; newValue=").append(getNewValue());
157 sb.append("; propagationId=").append(getPropagationId());
158 sb.append("; source=").append(getSource());
159 return sb.append("]").toString();
162 void appendTo(StringBuilder sb) {