001 /* 002 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Sun designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Sun in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 022 * CA 95054 USA or visit www.sun.com if you need additional information or 023 * have any questions. 024 */ 025 026 package javax.lang.model.type; 027 028 029 import javax.lang.model.element.Element; 030 import javax.lang.model.element.TypeParameterElement; 031 import javax.lang.model.util.Types; 032 033 034 /** 035 * Represents a type variable. 036 * A type variable may be explicitly declared by a 037 * {@linkplain TypeParameterElement type parameter} of a 038 * type, method, or constructor. 039 * A type variable may also be declared implicitly, as by 040 * the capture conversion of a wildcard type argument 041 * (see chapter 5 of <i>The Java Language Specification, Third 042 * Edition</i>). 043 * 044 * @author Joseph D. Darcy 045 * @author Scott Seligman 046 * @author Peter von der Ahé 047 * @see TypeParameterElement 048 * @since 1.6 049 */ 050 public interface TypeVariable extends ReferenceType { 051 052 /** 053 * Returns the element corresponding to this type variable. 054 * 055 * @return the element corresponding to this type variable 056 */ 057 Element asElement(); 058 059 /** 060 * Returns the upper bound of this type variable. 061 * 062 * <p> If this type variable was declared with no explicit 063 * upper bounds, the result is {@code java.lang.Object}. 064 * If it was declared with multiple upper bounds, 065 * the result is an intersection type (modeled as a 066 * {@link DeclaredType}). 067 * Individual bounds can be found by examining the result's 068 * {@linkplain Types#directSupertypes(TypeMirror) supertypes}. 069 * 070 * @return the upper bound of this type variable 071 */ 072 TypeMirror getUpperBound(); 073 074 /** 075 * Returns the lower bound of this type variable. While a type 076 * parameter cannot include an explicit lower bound declaration, 077 * capture conversion can produce a type variable with a 078 * non-trivial lower bound. Type variables otherwise have a 079 * lower bound of {@link NullType}. 080 * 081 * @return the lower bound of this type variable 082 */ 083 TypeMirror getLowerBound(); 084 }