01: /*
02: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package javax.lang.model.type;
27:
28: import javax.lang.model.element.Element;
29: import javax.lang.model.element.TypeParameterElement;
30: import javax.lang.model.util.Types;
31:
32: /**
33: * Represents a type variable.
34: * A type variable may be explicitly declared by a
35: * {@linkplain TypeParameterElement type parameter} of a
36: * type, method, or constructor.
37: * A type variable may also be declared implicitly, as by
38: * the capture conversion of a wildcard type argument
39: * (see chapter 5 of <i>The Java Language Specification, Third
40: * Edition</i>).
41: *
42: * @author Joseph D. Darcy
43: * @author Scott Seligman
44: * @author Peter von der Ahé
45: * @version 1.10 07/05/05
46: * @see TypeParameterElement
47: * @since 1.6
48: */
49: public interface TypeVariable extends ReferenceType {
50:
51: /**
52: * Returns the element corresponding to this type variable.
53: *
54: * @return the element corresponding to this type variable
55: */
56: Element asElement();
57:
58: /**
59: * Returns the upper bound of this type variable.
60: *
61: * <p> If this type variable was declared with no explicit
62: * upper bounds, the result is {@code java.lang.Object}.
63: * If it was declared with multiple upper bounds,
64: * the result is an intersection type (modeled as a
65: * {@link DeclaredType}).
66: * Individual bounds can be found by examining the result's
67: * {@linkplain Types#directSupertypes(TypeMirror) supertypes}.
68: *
69: * @return the upper bound of this type variable
70: */
71: TypeMirror getUpperBound();
72:
73: /**
74: * Returns the lower bound of this type variable. While a type
75: * parameter cannot include an explicit lower bound declaration,
76: * capture conversion can produce a type variable with a
77: * non-trivial lower bound. Type variables otherwise have a
78: * lower bound of {@link NullType}.
79: *
80: * @return the lower bound of this type variable
81: */
82: TypeMirror getLowerBound();
83: }
|