01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.beans.beancontext;
19:
20: import java.util.Arrays;
21: import java.util.Collection;
22: import java.util.Iterator;
23:
24: import org.apache.harmony.beans.internal.nls.Messages;
25:
26: @SuppressWarnings("unchecked")
27: public class BeanContextMembershipEvent extends BeanContextEvent {
28:
29: private static final long serialVersionUID = 3499346510334590959L;
30:
31: protected Collection children;
32:
33: public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
34: super (bc);
35:
36: if (changes == null) {
37: throw new NullPointerException(Messages
38: .getString("beans.0E")); //$NON-NLS-1$
39: }
40:
41: this .children = changes;
42: }
43:
44: public BeanContextMembershipEvent(BeanContext bc, Object[] changes) {
45: super (bc);
46:
47: if (changes == null) {
48: throw new NullPointerException(Messages
49: .getString("beans.0E")); //$NON-NLS-1$
50: }
51:
52: // Initialize collection
53: this .children = Arrays.asList(changes);
54: }
55:
56: public boolean contains(Object child) {
57: return this .children.contains(child);
58: }
59:
60: public Iterator iterator() {
61: return this .children.iterator();
62: }
63:
64: public int size() {
65: return this .children.size();
66: }
67:
68: public Object[] toArray() {
69: return this.children.toArray();
70: }
71: }
|