Interface ITypeParameter
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable, IJavaElement, ISourceReference
- All Known Implementing Classes:
AssistTypeParameter, TypeParameter
Represents a type parameter defined by a type or a method
in a compilation unit or a class file.
Type parameters are obtained using IType.getTypeParameter(String) and
IMethod.getTypeParameter(String).
Note that type parameters are not children of their declaring type or method. To get a list
of the type parameters use IType.getTypeParameters() for a type and use
IMethod.getTypeParameters() for a method.
- Since:
- 3.1
-
Field Summary
Fields inherited from interface IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETERModifier and TypeFieldDescriptionstatic final intConstant representing an annotation.static final intConstant representing a class file.static final intConstant representing a Java compilation unit.static final intConstant representing a field.static final intConstant representing all import declarations within a compilation unit.static final intConstant representing an import declaration within a compilation unit.static final intConstant representing a stand-alone instance or class initializer.static final intConstant representing a Java model (workspace level object).static final intConstant represents a module descriptor.static final intConstant representing a Java project.static final intConstant representing a local variable declaration.static final intConstant representing a method or constructor.static final intConstant representing a package declaration within a compilation unit.static final intConstant representing a package fragment.static final intConstant representing a package fragment root.static final intConstant representing a type (a class or interface).static final intConstant representing a type parameter declaration. -
Method Summary
Modifier and TypeMethodDescriptionString[]Returns the names of the class and interface bounds of this type parameter.String[]Returns the signatures for this type parameter's bounds.Returns the declaring member of this type parameter.Returns the Java type root in which this type parameter is declared.Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapterMethods inherited from interface IJavaElement
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementName, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnownModifier and TypeMethodDescriptionbooleanexists()Returns whether this Java element exists in the model.getAncestor(int ancestorType) Returns this Java element or the first ancestor of this element that has the given type.getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the Javadoc as HTML source if this element has attached Javadoc,nullotherwise.org.eclipse.core.resources.IResourceReturns the resource that corresponds directly to this element, ornullif there is no resource that corresponds to this element.Returns the name of this element.intReturns this element's kind encoded as an integer.Returns a string representation of this element handle.Returns the Java model.Returns the Java project this element is contained in, ornullif this element is not contained in any Java project (for instance, theIJavaModelis not contained in any Java project).Returns the first openable parent.Returns the element directly containing this element, ornullif this element has no parent.org.eclipse.core.runtime.IPathgetPath()Returns the path to the innermost resource enclosing this element.Returns the primary element (whose compilation unit is the primary compilation unit) this working copy element was created from, or this element if it is a descendant of a primary compilation unit or if it is not a descendant of a working copy (e.g.org.eclipse.core.resources.IResourceReturns the innermost resource enclosing this element.org.eclipse.core.runtime.jobs.ISchedulingRuleReturns the scheduling rule associated with this Java element.org.eclipse.core.resources.IResourceReturns the smallest underlying resource that contains this element, ornullif this element is not contained in a resource.booleanReturns whether this Java element is read-only.booleanReturns whether the structure of this element is known.Methods inherited from interface ISourceReference
exists, getNameRange, getSource, getSourceRangeModifier and TypeMethodDescriptionbooleanexists()Returns whether this element exists in the model.Returns the name range associated with this element.Returns the source code associated with this element.Returns the source range associated with this element.
-
Method Details
-
getBounds
Returns the names of the class and interface bounds of this type parameter. Returns an empty array if this type parameter has no bounds. A bound name is the name as it appears in the source (without theextendskeyword) if the type parameter comes from a compilation unit. It is the dot-separated fully qualified name of the bound if the type parameter comes from a class file.- Returns:
- the names of the bounds
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource
-
getBoundsSignatures
Returns the signatures for this type parameter's bounds. The type parameter may have been declared as part of a type or a method. The signatures represent only the individual bounds and do not include the type variable name or theextendskeyword. The signatures may be either unresolved (for source types) or resolved (for binary types). SeeSignaturefor details.- Returns:
- the signatures for the bounds of this formal type parameter
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.6
- See Also:
-
getDeclaringMember
IMember getDeclaringMember()Returns the declaring member of this type parameter. This can be either anITypeor anIMethod.This is a handle-only method.
- Returns:
- the declaring member of this type parameter.
-
getTypeRoot
ITypeRoot getTypeRoot()Returns the Java type root in which this type parameter is declared.This is a handle-only method.
- Returns:
- the Java type root in which this type parameter is declared
- Since:
- 3.7
-