jdk/src/share/classes/java/lang/reflect/ParameterizedType.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang.reflect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * ParameterizedType represents a parameterized type such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Collection<String>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <p>A parameterized type is created the first time it is needed by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * reflective method, as specified in this package. When a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * parameterized type p is created, the generic type declaration that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * p instantiates is resolved, and all type arguments of p are created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * recursively. See {@link java.lang.reflect.TypeVariable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * TypeVariable} for details on the creation process for type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * variables. Repeated creation of a parameterized type has no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <p>Instances of classes that implement this interface must implement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * an equals() method that equates any two instances that share the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * same generic type declaration and have equal type parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public interface ParameterizedType extends Type {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * Returns an array of {@code Type} objects representing the actual type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * arguments to this type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * <p>Note that in some cases, the returned array be empty. This can occur
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * if this type represents a non-parameterized type nested within
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * a parameterized type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * @return an array of {@code Type} objects representing the actual type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     *     arguments to this type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @throws TypeNotPresentException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *     actual type arguments refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @throws MalformedParameterizedTypeException if any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *     actual type parameters refer to a parameterized type that cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *     be instantiated for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    Type[] getActualTypeArguments();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Returns the {@code Type} object representing the class or interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * that declared this type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @return the {@code Type} object representing the class or interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     *     that declared this type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    Type getRawType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Returns a {@code Type} object representing the type that this type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * is a member of.  For example, if this type is {@code O<T>.I<S>},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * return a representation of {@code O<T>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * <p>If this type is a top-level type, {@code null} is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @return a {@code Type} object representing the type that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *     this type is a member of. If this type is a top-level type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *     {@code null} is returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @throws TypeNotPresentException if the owner type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *     refers to a non-existent type declaration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @throws MalformedParameterizedTypeException if the owner type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *     refers to a parameterized type that cannot be instantiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *     for any reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    Type getOwnerType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
}