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 * A pattern type, such as the upper bounded wildcard {@code
22 * ? extends Closeable} or the lower bounded wildcard {@code ? super String}.
23 *
24 * <p>Although this interface permits an arbitrary number of upper and lower
25 * bounds, all wildcard types of Java language programs are in one of two forms:
26 * <ol>
27 * <li><strong>No lower bound and one upper bound.</strong> Such types are
28 *     written like {@code ? extends java.lang.Number}. When the upper bound is
29 *     {@code java.lang.Object}, the {@code extends java.lang.Object} suffix is
30 *     optional: {@code Set<?>} is shorthand for {@code
31 *     Set<? extends java.lang.Object>}.
32 * <li><strong>One lower bound and an upper bound of {@code
33 *     java.lang.Object}.</strong> Such types are written like {@code
34 *     ? super java.lang.String}.
35 * </ol>
36 */
37public interface WildcardType extends Type {
38    /**
39     * Returns the array of types that represent the upper bounds of this type.
40     * The default upper bound is {@code Object}.
41     *
42     * @return an array containing the upper bounds types
43     *
44     * @throws TypeNotPresentException
45     *             if any of the bounds points to a missing type
46     * @throws MalformedParameterizedTypeException
47     *             if any bound points to a type that cannot be instantiated for
48     *             some reason
49     */
50    Type[] getUpperBounds();
51
52    /**
53     * Returns the array of types that represent the lower bounds of this type.
54     * The default lower bound is {@code null}, in which case an empty array is
55     * returned. Since only one lower bound is allowed, the returned array's
56     * length will never exceed one.
57     *
58     * @return an array containing the lower bounds types
59     *
60     * @throws TypeNotPresentException
61     *             if any of the bounds points to a missing type
62     * @throws MalformedParameterizedTypeException
63     *             if any of the bounds points to a type that cannot be
64     *             instantiated for some reason
65     */
66    Type[] getLowerBounds();
67}
68