Home | History | Annotate | Download | only in beans
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  * http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     14  * License for the specific language governing permissions and limitations under
     15  * the License.
     16  */
     17 
     18 package java.beans;
     19 
     20 /**
     21  * A type of {@link PropertyChangeEvent} that indicates that an indexed property
     22  * has changed.
     23  */
     24 public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
     25 
     26     private static final long serialVersionUID = -320227448495806870L;
     27 
     28     private final int index;
     29 
     30     /**
     31      * Creates a new property changed event with an indication of the property
     32      * index.
     33      *
     34      * @param source
     35      *            the changed bean.
     36      * @param propertyName
     37      *            the changed property, or <code>null</code> to indicate an
     38      *            unspecified set of the properties has changed.
     39      * @param oldValue
     40      *            the previous value of the property, or <code>null</code> if
     41      *            the <code>propertyName</code> is <code>null</code> or the
     42      *            previous value is unknown.
     43      * @param newValue
     44      *            the new value of the property, or <code>null</code> if the
     45      *            <code>propertyName</code> is <code>null</code> or the new
     46      *            value is unknown..
     47      * @param index
     48      *            the index of the property.
     49      */
     50     public IndexedPropertyChangeEvent(Object source, String propertyName,
     51             Object oldValue, Object newValue, int index) {
     52         super(source, propertyName, oldValue, newValue);
     53         this.index = index;
     54     }
     55 
     56     /**
     57      * Returns the index of the property that was changed in this event.
     58      */
     59     public int getIndex() {
     60         return index;
     61     }
     62 }
     63