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, 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 18package java.lang.reflect; 19 20/** 21 * This interface represents a parameterized type such as {@code 22 * 'Set<String>'}. 23 * 24 * @since 1.5 25 */ 26public interface ParameterizedType extends Type { 27 28 /** 29 * Returns an array of the actual type arguments for this type. 30 * <p> 31 * If this type models a non parameterized type nested within a 32 * parameterized type, this method returns a zero length array. The generic 33 * type of the following {@code field} declaration is an example for a 34 * parameterized type without type arguments. 35 * 36 * <pre> 37 * A<String>.B field; 38 * 39 * class A<T> { 40 * class B { 41 * } 42 * }</pre> 43 * 44 * 45 * @return the actual type arguments 46 * 47 * @throws TypeNotPresentException 48 * if one of the type arguments cannot be found 49 * @throws MalformedParameterizedTypeException 50 * if one of the type arguments cannot be instantiated for some 51 * reason 52 */ 53 Type[] getActualTypeArguments(); 54 55 /** 56 * Returns the parent / owner type, if this type is an inner type, otherwise 57 * {@code null} is returned if this is a top-level type. 58 * 59 * @return the owner type or {@code null} if this is a top-level type 60 * 61 * @throws TypeNotPresentException 62 * if one of the type arguments cannot be found 63 * @throws MalformedParameterizedTypeException 64 * if the owner type cannot be instantiated for some reason 65 */ 66 Type getOwnerType(); 67 68 /** 69 * Returns the declaring type of this parameterized type. 70 * <p> 71 * The raw type of {@code Set<String> field;} is {@code Set}. 72 * 73 * @return the raw type of this parameterized type 74 */ 75 Type getRawType(); 76} 77