Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java
38829 views
/*1* Copyright (c) 2003, 2011, 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*/24package java.beans;2526/**27* An "IndexedPropertyChange" event gets delivered whenever a component that28* conforms to the JavaBeans™ specification (a "bean") changes a bound29* indexed property. This class is an extension of <code>PropertyChangeEvent</code>30* but contains the index of the property that has changed.31* <P>32* Null values may be provided for the old and the new values if their33* true values are not known.34* <P>35* An event source may send a null object as the name to indicate that an36* arbitrary set of if its properties have changed. In this case the37* old and new values should also be null.38*39* @since 1.540* @author Mark Davidson41*/42public class IndexedPropertyChangeEvent extends PropertyChangeEvent {43private static final long serialVersionUID = -320227448495806870L;4445private int index;4647/**48* Constructs a new <code>IndexedPropertyChangeEvent</code> object.49*50* @param source The bean that fired the event.51* @param propertyName The programmatic name of the property that52* was changed.53* @param oldValue The old value of the property.54* @param newValue The new value of the property.55* @param index index of the property element that was changed.56*/57public IndexedPropertyChangeEvent(Object source, String propertyName,58Object oldValue, Object newValue,59int index) {60super (source, propertyName, oldValue, newValue);61this.index = index;62}6364/**65* Gets the index of the property that was changed.66*67* @return The index specifying the property element that was68* changed.69*/70public int getIndex() {71return index;72}7374void appendTo(StringBuilder sb) {75sb.append("; index=").append(getIndex());76}77}787980