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
18package java.beans;
19
20/**
21 * A type of {@link PropertyChangeEvent} that indicates that an indexed property
22 * has changed.
23 *
24 * @since Android 1.0
25 */
26public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
27
28    private static final long serialVersionUID = -320227448495806870L;
29
30    private final int index;
31
32    /**
33     * Creates a new property changed event with an indication of the property
34     * index.
35     *
36     * @param source
37     *            the changed bean.
38     * @param propertyName
39     *            the changed property, or <code>null</code> to indicate an
40     *            unspecified set of the properties has changed.
41     * @param oldValue
42     *            the previous value of the property, or <code>null</code> if
43     *            the <code>propertyName</code> is <code>null</code> or the
44     *            previous value is unknown.
45     * @param newValue
46     *            the new value of the property, or <code>null</code> if the
47     *            <code>propertyName</code> is <code>null</code> or the new
48     *            value is unknown..
49     * @param index
50     *            the index of the property.
51     */
52    public IndexedPropertyChangeEvent(Object source, String propertyName,
53            Object oldValue, Object newValue, int index) {
54        super(source, propertyName, oldValue, newValue);
55        this.index = index;
56    }
57
58    /**
59     * Answer the index of the property that was changed in this event.
60     *
61     * @return the property element index.
62     */
63    public int getIndex() {
64        return index;
65    }
66}
67