1 /* 2 * @(#)WildcardType.java 1.3 04/01/12 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.lang.reflect; 9 10 /** 11 * WildcardType represents a wildcard type expression, such as 12 * <tt>?</tt>, <tt>? extends Number</tt>, or <tt>? super Integer</tt>. 13 * 14 * @since 1.5 15 */ 16 public interface WildcardType extends Type { 17 /** 18 * Returns an array of <tt>Type</tt> objects representing the upper 19 * bound(s) of this type variable. Note that if no upper bound is 20 * explicitly declared, the upper bound is <tt>Object</tt>. 21 * 22 * <p>For each upper bound B : 23 * <ul> 24 * <li>if B is a parameterized type or a type variable, it is created, 25 * (see {@link java.lang.reflect.ParameterizedType ParameterizedType} 26 * for the details of the creation process for parameterized types). 27 * <li>Otherwise, B is resolved. 28 * </ul> 29 * 30 * @return an array of Types representing the upper bound(s) of this 31 * type variable 32 * @throws TypeNotPresentException if any of the 33 * bounds refers to a non-existent type declaration 34 * @throws MalformedParameterizedTypeException if any of the 35 * bounds refer to a parameterized type that cannot be instantiated 36 * for any reason 37 */ 38 Type[] getUpperBounds(); 39 40 /** 41 * Returns an array of <tt>Type</tt> objects representing the 42 * lower bound(s) of this type variable. Note that if no lower bound is 43 * explicitly declared, the lower bound is the type of <tt>null</tt>. 44 * In this case, a zero length array is returned. 45 * 46 * <p>For each lower bound B : 47 * <ul> 48 * <li>if B is a parameterized type or a type variable, it is created, 49 * (see {@link java.lang.reflect.ParameterizedType ParameterizedType} 50 * for the details of the creation process for parameterized types). 51 * <li>Otherwise, B is resolved. 52 * </ul> 53 * 54 * @return an array of Types representing the lower bound(s) of this 55 * type variable 56 * @throws TypeNotPresentException if any of the 57 * bounds refers to a non-existent type declaration 58 * @throws MalformedParameterizedTypeException if any of the 59 * bounds refer to a parameterized type that cannot be instantiated 60 * for any reason 61 */ 62 Type[] getLowerBounds(); 63 // one or many? Up to language spec; currently only one, but this API 64 // allows for generalization. 65 } 66 67