• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package signature.compare.model.subst;
18 
19 import signature.model.IAnnotation;
20 import signature.model.IClassDefinition;
21 import signature.model.IExecutableMember;
22 import signature.model.IParameter;
23 import signature.model.ITypeReference;
24 import signature.model.ITypeVariableDefinition;
25 import signature.model.Modifier;
26 
27 import java.util.LinkedList;
28 import java.util.List;
29 import java.util.Map;
30 import java.util.Set;
31 
32 public abstract class ExecutableMemberProjection implements IExecutableMember {
33 
34     private final IExecutableMember original;
35     private final Map<ITypeVariableDefinition, ITypeReference> mappings;
36 
ExecutableMemberProjection(IExecutableMember original, Map<ITypeVariableDefinition, ITypeReference> mappings)37     public ExecutableMemberProjection(IExecutableMember original,
38             Map<ITypeVariableDefinition, ITypeReference> mappings) {
39         this.original = original;
40         this.mappings = mappings;
41     }
42 
getAnnotations()43     public Set<IAnnotation> getAnnotations() {
44         return original.getAnnotations();
45     }
46 
getDeclaringClass()47     public IClassDefinition getDeclaringClass() {
48         throw new UnsupportedOperationException();
49     }
50 
getExceptions()51     public Set<ITypeReference> getExceptions() {
52         return ViewpointAdapter.substitutedTypeReferences(original
53                 .getExceptions(), mappings);
54     }
55 
getModifiers()56     public Set<Modifier> getModifiers() {
57         return original.getModifiers();
58     }
59 
getName()60     public String getName() {
61         return original.getName();
62     }
63 
getParameters()64     public List<IParameter> getParameters() {
65         List<IParameter> result = new LinkedList<IParameter>();
66         for (IParameter parameter : original.getParameters()) {
67             result.add(new ParameterProjection(parameter, mappings));
68         }
69         return result;
70     }
71 
getTypeParameters()72     public List<ITypeVariableDefinition> getTypeParameters() {
73         // FIXME bounds need to be substituted ?
74         return original.getTypeParameters();
75     }
76 }
77