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.model.util; 18 19 import signature.model.IClassReference; 20 import signature.model.IGenericDeclaration; 21 import signature.model.ITypeReference; 22 import signature.model.ITypeVariableReference; 23 import signature.model.impl.SigArrayType; 24 import signature.model.impl.SigClassDefinition; 25 import signature.model.impl.SigParameterizedType; 26 import signature.model.impl.SigTypeVariableDefinition; 27 import signature.model.impl.SigWildcardType; 28 29 import java.util.List; 30 31 public interface ITypeFactory { 32 33 public static final String JAVA_LANG_OBJECT = "java.lang.Object"; 34 35 /** 36 * Returns the existing type or creates a new one.<br> 37 * Format: java.lang.Object 38 */ 39 public SigClassDefinition getClass(String packageName, String className); 40 41 public IClassReference getClassReference(String packageName, 42 String className); 43 44 /** 45 * Returns the existing array type or creates a new one. 46 * 47 * @param componentType 48 * the component type of the array 49 * @return the array type 50 */ 51 public SigArrayType getArrayType(ITypeReference componentType); 52 53 /** 54 * Returns the existing parameterized type or creates a new one. 55 * 56 * @param ownerType 57 * the owner of the parameterized type 58 * @param rawType 59 * the type which is parameterized 60 * @param typeArguments 61 * the type arguments 62 * @return the parameterized type 63 */ 64 public SigParameterizedType getParameterizedType(ITypeReference ownerType, 65 IClassReference rawType, List<ITypeReference> typeArguments); 66 67 68 public boolean containsTypeVariableDefinition(String name, 69 IGenericDeclaration genericDeclaration); 70 71 /** 72 * Returns the existing type variable or creates a new one. 73 * 74 * @param genericDeclaration 75 * the declaration site of the variable 76 * @param name 77 * the name of the type variable 78 * @return the type variable 79 */ 80 public SigTypeVariableDefinition getTypeVariable(String name, 81 IGenericDeclaration genericDeclaration); 82 83 public ITypeVariableReference getTypeVariableReference(String name, 84 IGenericDeclaration genericDeclaration); 85 86 /** 87 * Returns the existing wildcard type or creates a new one. Wildcard types 88 * are equal if they have the same lower bound and have the same upper 89 * bounds. The order of the upper bounds is irrelevant except for the first 90 * element. <br> 91 * Note: This does not mean that two values with equal wildcard type can be 92 * assigned to each other! 93 * 94 * @param lowerBound 95 * the lower bound 96 * @param upperBounds 97 * the upper bounds 98 * @return the wildcard type 99 */ 100 public SigWildcardType getWildcardType(ITypeReference lowerBound, 101 List<ITypeReference> upperBounds); 102 103 } 104