KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > reflect > ParameterizedType


1 /*
2  * @(#)ParameterizedType.java 1.4 04/02/06
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 /**
12  * ParameterizedType represents a parameterized type such as
13  * Collection<String>.
14  *
15  * <p>A parameterized type is created the first time it is needed by a
16  * reflective method, as specified in this package. When a
17  * parameterized type p is created, the generic type declaration that
18  * p instantiates is resolved, and all type arguments of p are created
19  * recursively. See {@link java.lang.reflect.TypeVariable
20  * TypeVariable} for details on the creation process for type
21  * variables. Repeated creation of a parameterized type has no effect.
22  *
23  * <p>Instances of classes that implement this interface must implement
24  * an equals() method that equates any two instances that share the
25  * same generic type declaration and have equal type parameters.
26  *
27  * @since 1.5
28  */

29 public interface ParameterizedType extends Type JavaDoc {
30     /**
31      * Returns an array of <tt>Type</tt> objects representing the actual type
32      * arguments to this type.
33      *
34      * <p>Note that in some cases, the returned array be empty. This can occur
35      * if this type represents a non-parameterized type nested within
36      * a parameterized type.
37      *
38      * @return an array of <tt>Type</tt> objects representing the actual type
39      * arguments to this type
40      * @throws <tt>TypeNotPresentException</tt> if any of the
41      * actual type arguments refers to a non-existent type declaration
42      * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
43      * actual type parameters refer to a parameterized type that cannot
44      * be instantiated for any reason
45      * @since 1.5
46      */

47     Type JavaDoc[] getActualTypeArguments();
48
49     /**
50      * Returns the <tt>Type</tt> object representing the class or interface
51      * that declared this type.
52      *
53      * @return the <tt>Type</tt> object representing the class or interface
54      * that declared this type
55      * @since 1.5
56      */

57     Type JavaDoc getRawType();
58
59     /**
60      * Returns a <tt>Type</tt> object representing the type that this type
61      * is a member of. For example, if this type is {@code O<T>.I<S>},
62      * return a representation of {@code O<T>}.
63      *
64      * <p>If this type is a top-level type, <tt>null</tt> is returned.
65      *
66      * @return a <tt>Type</tt> object representing the type that
67      * this type is a member of. If this type is a top-level type,
68      * <tt>null</tt> is returned
69      * @throws <tt>TypeNotPresentException</tt> if the owner type
70      * refers to a non-existent type declaration
71      * @throws <tt>MalformedParameterizedTypeException</tt> if the owner type
72      * refers to a parameterized type that cannot be instantiated
73      * for any reason
74      * @since 1.5
75      */

76     Type JavaDoc getOwnerType();
77 }
78
79
Popular Tags