Interface TypeParameterElement
- All Superinterfaces:
AnnotatedConstruct, Element
public interface TypeParameterElement extends Element
Represents a formal type parameter of a generic class, interface, method, or constructor element. A type parameter declares a
TypeVariable.- See Java Language Specification:
- 8.1.2 Generic Classes and Type Parameters
8.4.4 Generic Methods
8.8.4 Generic Constructors
9.1.2 Generic Interfaces and Type Parameters
- Since:
- 1.6
- See Also:
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
TypeMirror |
asType() |
Returns the type variable corresponding to this type parameter element. |
List |
getBounds() |
Returns the bounds of this type parameter. |
Element |
getEnclosingElement() |
Returns the generic element of this type parameter. |
Element |
getGenericElement() |
Returns the generic class, interface, method, or constructor that is parameterized by this type parameter. |
Methods declared in interface Element
accept, equals, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getEnclosedElements, getKind, getModifiers, getSimpleName, hashCode | Modifier and Type | Method | Description |
|---|---|---|
<R, |
accept |
Applies a visitor to this element. |
boolean |
equals |
Returns true if the argument represents the same element as this, or false otherwise. |
<A extends Annotation> |
getAnnotation |
Returns this construct's annotation of the specified type if such an annotation is present, else null. |
List |
getAnnotationMirrors() |
Returns the annotations that are directly present on this construct. |
<A extends Annotation> |
getAnnotationsByType |
Returns annotations of the specified type that are associated with this construct. |
List |
getEnclosedElements() |
Returns the elements that are, loosely speaking, directly enclosed by this element. |
ElementKind |
getKind() |
Returns the kind of this element. |
Set |
getModifiers() |
Returns the modifiers of this element, excluding annotations. |
Name |
getSimpleName() |
Returns the simple (unqualified) name of this element. |
int |
hashCode() |
Obeys the general contract of Object.hashCode. |
Method Details
asType
TypeMirror asType()
Returns the type variable corresponding to this type parameter element.
- Specified by:
-
asTypein interfaceElement - Returns:
- the type variable corresponding to this type parameter element
- See Also:
getGenericElement
Element getGenericElement()
Returns the generic class, interface, method, or constructor that is parameterized by this type parameter.
- Returns:
- the generic class, interface, method, or constructor that is parameterized by this type parameter
getBounds
List<? extends TypeMirror> getBounds()
Returns the bounds of this type parameter. These are the types given by the
extends clause used to declare this type parameter. If no explicit extends clause was used, then java.lang.Object is considered to be the sole bound.- Returns:
- the bounds of this type parameter, or an empty list if there are none
getEnclosingElement
Element getEnclosingElement()
Returns the generic element of this type parameter.
- Specified by:
-
getEnclosingElementin interfaceElement - Returns:
- the generic element of this type parameter
- See Also:
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.