]> source.dussan.org Git - aspectj.git/blob
5ba0229dc7aa2d289cef6ea5f6f802d40b7605e2
[aspectj.git] /
1 /* *******************************************************************
2  * Copyright (c) 2010 Contributors
3  * All rights reserved. 
4  * This program and the accompanying materials are made available 
5  * under the terms of the Eclipse Public License v1.0 
6  * which accompanies this distribution and is available at 
7  * http://www.eclipse.org/legal/epl-v10.html 
8  * 
9  * Contributors:
10  * Andy Clement - SpringSource
11  * ******************************************************************/
12 package org.aspectj.ajdt.internal.compiler.lookup;
13
14 import java.util.HashSet;
15 import java.util.Set;
16
17 import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
18 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ITypeFinder;
19 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
20 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
21
22 /**
23  * The member finder looks after intertype declared inner classes on a type, there is one member finder per type that was hit by an
24  * new inner type declaration.
25  * 
26  * @author Andy Clement
27  * @since 1.6.9
28  */
29 public class IntertypeMemberTypeFinder implements ITypeFinder {
30
31         // Target that has these new types
32         public SourceTypeBinding targetTypeBinding;
33
34         // The new types declared onto the target
35         private Set<ReferenceBinding> intertypeMemberTypes = new HashSet<ReferenceBinding>();
36
37         public void addInterTypeMemberType(ReferenceBinding binding) {
38                 intertypeMemberTypes.add(binding);
39                 // ReferenceBinding[] rbs = targetTypeBinding.memberTypes();
40                 // ReferenceBinding[] newRbs = new ReferenceBinding[rbs.length + 1];
41                 // System.arraycopy(rbs, 0, newRbs, 1, rbs.length);
42                 // newRbs[0] = binding;
43                 // (targetTypeBinding).memberTypes = newRbs;
44
45         }
46
47         public ReferenceBinding getMemberType(char[] memberTypeName) {
48                 for (ReferenceBinding intertypeMemberType : intertypeMemberTypes) {
49                         if (CharOperation.equals(intertypeMemberType.sourceName, memberTypeName)) {
50                                 return intertypeMemberType;
51                         }
52                 }
53                 return null;
54         }
55
56         public ReferenceBinding[] getMemberTypes() {
57                 ReferenceBinding[] array = new ReferenceBinding[intertypeMemberTypes.size()];
58                 return intertypeMemberTypes.toArray(array);
59         }
60
61 }