KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > type > TypeVariable


1 /*
2  * @(#)TypeVariable.java 1.4 06/07/31
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.type;
9
10
11 import javax.lang.model.element.Element;
12 import javax.lang.model.element.TypeParameterElement;
13 import javax.lang.model.util.Types;
14
15
16 /**
17  * Represents a type variable.
18  * A type variable may be explicitly declared by a
19  * {@linkplain TypeParameterElement type parameter} of a
20  * type, method, or constructor.
21  * A type variable may also be declared implicitly, as by
22  * the capture conversion of a wildcard type argument
23  * (see chapter 5 of <i>The Java Language Specification, Third
24  * Edition</i>).
25  *
26  * @author Joseph D. Darcy
27  * @author Scott Seligman
28  * @author Peter von der Ah&eacute;
29  * @version 1.4 06/07/31
30  * @see TypeParameterElement
31  * @since 1.6
32  */

33 public interface TypeVariable extends ReferenceType {
34
35     /**
36      * Returns the element corresponding to this type variable.
37      *
38      * @return the element corresponding to this type variable
39      */

40     Element asElement();
41
42     /**
43      * Returns the upper bound of this type variable.
44      *
45      * <p> If this type variable was declared with no explicit
46      * upper bounds, the result is {@code java.lang.Object}.
47      * If it was declared with multiple upper bounds,
48      * the result is an intersection type (modeled as a
49      * {@link DeclaredType}).
50      * Individual bounds can be found by examining the result's
51      * {@linkplain Types#directSupertypes(TypeMirror) supertypes}.
52      *
53      * @return the upper bound of this type variable
54      */

55     TypeMirror getUpperBound();
56
57     /**
58      * Returns the lower bound of this type variable. While a type
59      * parameter cannot include an explicit lower bound declaration,
60      * capture conversion can produce a type variable with a
61      * non-trivial lower bound. Type variables otherwise have a
62      * lower bound of {@link NullType}.
63      *
64      * @return the lower bound of this type variable
65      */

66     TypeMirror getLowerBound();
67 }
68
Popular Tags