public interface IType extends IMember, IAnnotatable
Note that the element name of an anonymous source type and lambda expressions
is always empty. Types representing lambda expressions are pseudo-elements
and not included in the children of their parent. Lambda expressions are created
as the result of a ICodeAssist.codeSelect(...)
. For more information
on such pseudo-elements, see ILocalVariable
.
If a binary type cannot be parsed, its structure remains unknown.
Use IJavaElement.isStructureKnown
to determine whether this
is the case.
The children are of type IMember
, which includes IField
,
IMethod
, IInitializer
and IType
.
The children are listed in the order in which they appear in the source or class file.
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
Modifier and Type | Method and Description |
---|---|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor)
Do code completion inside a code snippet in the context of the current type.
|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor,
IProgressMonitor monitor)
Do code completion inside a code snippet in the context of the current type.
|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor,
WorkingCopyOwner owner)
Do code completion inside a code snippet in the context of the current type.
|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor,
WorkingCopyOwner owner,
IProgressMonitor monitor)
Do code completion inside a code snippet in the context of the current type.
|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
ICompletionRequestor requestor)
Deprecated.
|
void |
codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
ICompletionRequestor requestor,
WorkingCopyOwner owner)
Deprecated.
|
IField |
createField(String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a field in this type with the
given contents.
|
IInitializer |
createInitializer(String contents,
IJavaElement sibling,
IProgressMonitor monitor)
Creates and returns a static initializer in this type with the
given contents.
|
IMethod |
createMethod(String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a method or constructor in this type with the
given contents.
|
IType |
createType(String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a type in this type with the
given contents.
|
IMethod[] |
findMethods(IMethod method)
Finds the methods in this type that correspond to
the given method.
|
IJavaElement[] |
getChildrenForCategory(String category)
Returns the children of this type that have the given category as a
@category tag. |
String |
getElementName()
Returns the simple name of this type, unqualified by package or enclosing type.
|
IField |
getField(String name)
Returns the field with the specified name
in this type (for example,
"bar" ). |
IField[] |
getFields()
Returns the fields declared by this type in the order in which they appear
in the source or class file.
|
String |
getFullyQualifiedName()
Returns the fully qualified name of this type,
including qualification for any containing types and packages.
|
String |
getFullyQualifiedName(char enclosingTypeSeparator)
Returns the fully qualified name of this type,
including qualification for any containing types and packages.
|
String |
getFullyQualifiedParameterizedName()
Returns this type's fully qualified name using a '.' enclosing type separator
followed by its type parameters between angle brackets if it is a generic type.
|
IInitializer |
getInitializer(int occurrenceCount)
Returns the initializer with the specified position relative to
the order they are defined in the source.
|
IInitializer[] |
getInitializers()
Returns the initializers declared by this type.
|
String |
getKey()
Returns the binding key for this type only if the given type is
resolved . |
IMethod |
getMethod(String name,
String[] parameterTypeSignatures)
Returns the method with the specified name and parameter types
in this type (for example,
"foo", {"I", "QString;"} ). |
IMethod[] |
getMethods()
Returns the methods and constructors declared by this type.
|
IPackageFragment |
getPackageFragment()
Returns the package fragment in which this element is defined.
|
String |
getSuperclassName()
Returns the name of this type's superclass, or
null
for source types that do not specify a superclass. |
String |
getSuperclassTypeSignature()
Returns the type signature of this type's superclass, or
null if none. |
String[] |
getSuperInterfaceNames()
Returns the names of interfaces that this type implements or extends,
in the order in which they are listed in the source.
|
String[] |
getSuperInterfaceTypeSignatures()
Returns the type signatures of the interfaces that this type
implements or extends, in the order in which they are listed in the
source.
|
IType |
getType(String name)
Returns the member type declared in this type with the given simple name.
|
ITypeParameter |
getTypeParameter(String name)
Returns the type parameter declared in this type with the given name.
|
ITypeParameter[] |
getTypeParameters()
Returns the formal type parameters for this type.
|
String[] |
getTypeParameterSignatures()
Returns the formal type parameter signatures for this type.
|
String |
getTypeQualifiedName()
Returns the type-qualified name of this type,
including qualification for any enclosing types,
but not including package qualification.
|
String |
getTypeQualifiedName(char enclosingTypeSeparator)
Returns the type-qualified name of this type,
including qualification for any enclosing types,
but not including package qualification.
|
IType[] |
getTypes()
Returns the immediate member types declared by this type.
|
boolean |
isAnnotation()
Returns whether this type represents an annotation type.
|
boolean |
isAnonymous()
Returns whether this type represents an anonymous type.
|
boolean |
isClass()
Returns whether this type represents a class.
|
boolean |
isEnum()
Returns whether this type represents an enumeration class.
|
boolean |
isInterface()
Returns whether this type represents an interface.
|
boolean |
isLambda()
Returns whether this type represents a lambda expression.
|
boolean |
isLocal()
Returns whether this type represents a local type.
|
boolean |
isMember()
Returns whether this type represents a member type.
|
boolean |
isResolved()
Returns whether this type represents a resolved type.
|
ITypeHierarchy |
loadTypeHierachy(InputStream input,
IProgressMonitor monitor)
Loads a previously saved ITypeHierarchy from an input stream.
|
ITypeHierarchy |
newSupertypeHierarchy(ICompilationUnit[] workingCopies,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type and all of its supertypes, considering types in the given
working copies.
|
ITypeHierarchy |
newSupertypeHierarchy(IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type and all of its supertypes.
|
ITypeHierarchy |
newSupertypeHierarchy(IWorkingCopy[] workingCopies,
IProgressMonitor monitor)
Deprecated.
|
ITypeHierarchy |
newSupertypeHierarchy(WorkingCopyOwner owner,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type and all of its supertypes, considering types in the
working copies with the given owner.
|
ITypeHierarchy |
newTypeHierarchy(ICompilationUnit[] workingCopies,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes in the workspace,
considering types in the given working copies.
|
ITypeHierarchy |
newTypeHierarchy(IJavaProject project,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes
in the context of the given project.
|
ITypeHierarchy |
newTypeHierarchy(IJavaProject project,
WorkingCopyOwner owner,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes
in the context of the given project, considering types in the
working copies with the given owner.
|
ITypeHierarchy |
newTypeHierarchy(IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes in the workspace.
|
ITypeHierarchy |
newTypeHierarchy(IWorkingCopy[] workingCopies,
IProgressMonitor monitor)
Deprecated.
|
ITypeHierarchy |
newTypeHierarchy(WorkingCopyOwner owner,
IProgressMonitor monitor)
Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes in the workspace,
considering types in the working copies with the given owner.
|
String[][] |
resolveType(String typeName)
Resolves the given type name within the context of this type (depending on the type hierarchy
and its imports).
|
String[][] |
resolveType(String typeName,
WorkingCopyOwner owner)
Resolves the given type name within the context of this type (depending on the type hierarchy
and its imports) and using the given owner's working copies, considering types in the
working copies with the given owner.
|
getCategories, getClassFile, getCompilationUnit, getDeclaringType, getFlags, getJavadocRange, getOccurrenceCount, getType, getTypeRoot, isBinary
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown
getAdapter
exists, getNameRange, getSource, getSourceRange
copy, delete, move, rename
getChildren, hasChildren
getAnnotation, getAnnotations
void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor) throws JavaModelException
codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor)
instead.snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position within snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException
codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor,WorkingCopyOwner)
instead.Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
If the type has access to its source code and the insertion position is valid, then completion is performed against the source. Otherwise the completion is performed against the type structure and the given locals variables.
snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position with in snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestorowner
- the owner of working copies that take precedence over their original compilation unitsJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor) throws JavaModelException
snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position within snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, IProgressMonitor monitor) throws JavaModelException
If IProgressMonitor
is not null
then some proposals which
can be very long to compute are proposed. To avoid that the code assist operation
take too much time a IProgressMonitor
which automatically cancel the code
assist operation when a specified amount of time is reached could be used.
new IProgressMonitor() { private final static int TIMEOUT = 500; //ms private long endTime; public void beginTask(String name, int totalWork) { fEndTime= System.currentTimeMillis() + TIMEOUT; } public boolean isCanceled() { return endTime <= System.currentTimeMillis(); } ... };
snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position within snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestormonitor
- the progress monitor used to report progressJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
If the type has access to its source code and the insertion position is valid, then completion is performed against the source. Otherwise the completion is performed against the type structure and the given locals variables.
snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position with in snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestorowner
- the owner of working copies that take precedence over their original compilation unitsJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
If the type has access to its source code and the insertion position is valid, then completion is performed against the source. Otherwise the completion is performed against the type structure and the given locals variables.
If IProgressMonitor
is not null
then some proposals which
can be very long to compute are proposed. To avoid that the code assist operation
take too much time a IProgressMonitor
which automatically cancel the code
assist operation when a specified amount of time is reached could be used.
new IProgressMonitor() { private final static int TIMEOUT = 500; //ms private long endTime; public void beginTask(String name, int totalWork) { endTime= System.currentTimeMillis() + TIMEOUT; } public boolean isCanceled() { return endTime <= System.currentTimeMillis(); } ... };
snippet
- the code snippetinsertion
- the position with in source where the snippet
is inserted. This position must not be in comments.
A possible value is -1, if the position is not known.position
- the position with in snippet where the user
is performing code assist.localVariableTypeNames
- an array (possibly empty) of fully qualified
type names of local variables visible at the current scopelocalVariableNames
- an array (possibly empty) of local variable names
that are visible at the current scopelocalVariableModifiers
- an array (possible empty) of modifiers for
local variablesisStatic
- whether the current scope is in a static contextrequestor
- the completion requestorowner
- the owner of working copies that take precedence over their original compilation unitsmonitor
- the progress monitor used to report progressJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
Optionally, the new element can be positioned before the specified sibling. If no sibling is specified, the element will be inserted as the last field declaration in this type.
It is possible that a field with the same name already exists in this type.
The value of the force
parameter affects the resolution of
such a conflict:
true
- in this case the field is created with the new contentsfalse
- in this case a JavaModelException
is throwncontents
- the given contentssibling
- the given siblingforce
- a flag in case the same name already exists in this typemonitor
- the given progress monitorJavaModelException
- if the element could not be created. Reasons include:
CoreException
occurred while updating an underlying resource
IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException
Optionally, the new element can be positioned before the specified sibling. If no sibling is specified, the new initializer is positioned after the last existing initializer declaration, or as the first member in the type if there are no initializers.
contents
- the given contentssibling
- the given siblingmonitor
- the given progress monitorJavaModelException
- if the element could not be created. Reasons include:
CoreException
occurred while updating an underlying resource
IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
Optionally, the new element can be positioned before the specified sibling. If no sibling is specified, the element will be appended to this type.
It is possible that a method with the same signature already exists in this type.
The value of the force
parameter affects the resolution of
such a conflict:
true
- in this case the method is created with the new contentsfalse
- in this case a JavaModelException
is throwncontents
- the given contentssibling
- the given siblingforce
- a flag in case the same name already exists in this typemonitor
- the given progress monitorJavaModelException
- if the element could not be created. Reasons include:
CoreException
occurred while updating an underlying resource
IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
Optionally, the new type can be positioned before the specified sibling. If no sibling is specified, the type will be appended to this type.
It is possible that a type with the same name already exists in this type.
The value of the force
parameter affects the resolution of
such a conflict:
true
- in this case the type is created with the new contentsfalse
- in this case a JavaModelException
is throwncontents
- the given contentssibling
- the given siblingforce
- a flag in case the same name already exists in this typemonitor
- the given progress monitorJavaModelException
- if the element could not be created. Reasons include:
CoreException
occurred while updating an underlying resource
IMethod[] findMethods(IMethod method)
method
- the given methodnull
if no such methods can be found.IJavaElement[] getChildrenForCategory(String category) throws JavaModelException
@category
tag.
Returns an empty array if no children with this category exist.
The results are listed in the order in which they appear in the source or class file.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String getElementName()
getElementName
in interface IJavaElement
IField getField(String name)
"bar"
).
This is a handle-only method. The field may or may not exist.name
- the given nameIField[] getFields() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String getFullyQualifiedName()
'.'
,
followed by the type-qualified name.
Note: The enclosing type separator used in the type-qualified
name is '$'
, not '.'
.
getFullyQualifiedName('$')
.
This is a handle-only method.getTypeQualifiedName()
,
getFullyQualifiedName(char)
String getFullyQualifiedName(char enclosingTypeSeparator)
'.'
,
followed by the type-qualified name using the enclosingTypeSeparator
.
For example:
enclosingTypeSeparator
- the given enclosing type separatorgetTypeQualifiedName(char)
String getFullyQualifiedParameterizedName() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IInitializer getInitializer(int occurrenceCount)
occurrenceCount
- the specified positionIInitializer[] getInitializers() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String getKey()
resolved
.
A binding key is a key that uniquely identifies this type. It allows access
to generic info for parameterized types.
If the given type is not resolved, the returned key is simply the java element's key.
IBinding.getKey()
,
BindingKey
,
isResolved()
IMethod getMethod(String name, String[] parameterTypeSignatures)
"foo", {"I", "QString;"}
).
To get the handle for a constructor, the name specified must be the
simple name of the enclosing type.
This is a handle-only method. The method may or may not be present.
The type signatures may be either unresolved (for source types)
or resolved (for binary types), and either basic (for basic types)
or rich (for parameterized types). See Signature
for details.
name
- the given nameparameterTypeSignatures
- the given parameter typesIMethod[] getMethods() throws JavaModelException
<clinit>
method
and synthetic methods.
The results are listed in the order in which they appear in the source or class file.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IPackageFragment getPackageFragment()
String getSuperclassName() throws JavaModelException
null
for source types that do not specify a superclass.
For interfaces, the superclass name is always "java.lang.Object"
.
For source types, the name as declared is returned, for binary types,
the resolved, qualified name is returned.
For anonymous types, the superclass name is the name appearing after the 'new' keyword'.
If the superclass is a parameterized type, the string
may include its type arguments enclosed in "<>".
If the returned string is needed for anything other than display
purposes, use getSuperclassTypeSignature()
which returns
a structured type signature string containing more precise information.
null
for source types that do not specify a superclassJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String getSuperclassTypeSignature() throws JavaModelException
null
if none.
The type signature may be either unresolved (for source types)
or resolved (for binary types), and either basic (for basic types)
or rich (for parameterized types). See Signature
for details.
null
if noneJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String[] getSuperInterfaceTypeSignatures() throws JavaModelException
For classes and enum types, this gives the interfaces that this class implements. For interfaces and annotation types, this gives the interfaces that this interface extends. An empty collection is returned if this type does not implement or extend any interfaces. For anonymous types, an empty collection is always returned.
The type signatures may be either unresolved (for source types)
or resolved (for binary types), and either basic (for basic types)
or rich (for parameterized types). See Signature
for details.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String[] getSuperInterfaceNames() throws JavaModelException
For classes, this gives the interfaces that this class implements.
For interfaces, this gives the interfaces that this interface extends.
An empty collection is returned if this type does not implement or
extend any interfaces. For source types, simple names are returned,
for binary types, qualified names are returned.
For anonymous types, an empty collection is always returned.
If the list of supertypes includes parameterized types,
the string may include type arguments enclosed in "<>".
If the result is needed for anything other than display
purposes, use getSuperInterfaceTypeSignatures()
which returns
structured signature strings containing more precise information.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String[] getTypeParameterSignatures() throws JavaModelException
The formal type parameter signatures may be either unresolved (for source
types) or resolved (for binary types). See Signature
for details.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.Signature
ITypeParameter[] getTypeParameters() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType getType(String name)
name
- the given simple nameITypeParameter getTypeParameter(String name)
name
- the given simple nameString getTypeQualifiedName()
'$'
, followed by the simple name of this type
or the occurrence count of this type if it is anonymous.
For binary types, this is the name of the class file without the ".class" suffix.
This method is fully equivalent to getTypeQualifiedName('$')
.
This is a handle-only method.getTypeQualifiedName(char)
String getTypeQualifiedName(char enclosingTypeSeparator)
enclosingTypeSeparator
, followed by the
simple name of this type or the occurrence count of this type if it is anonymous.
For binary types, this is the name of the class file without the ".class" suffix,
and - since 3.4 - the '$' characters in the class file name are replaced with the
enclosingTypeSeparator
character.
For example:
enclosingTypeSeparator
- the specified enclosing type separatorIType[] getTypes() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isAnonymous() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isClass() throws JavaModelException
Note that a class can neither be an interface, an enumeration class, nor an annotation type.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isEnum() throws JavaModelException
Note that an enumeration class can neither be a class, an interface, nor an annotation type.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isInterface() throws JavaModelException
Note that an interface can also be an annotation type, but it can neither be a class nor an enumeration class.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isAnnotation() throws JavaModelException
Note that an annotation type is also an interface, but it can neither be a class nor an enumeration class.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isLocal() throws JavaModelException
Note: This deviates from JLS3 14.3, which states that anonymous types are not local types since they do not have a name.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeBinding.isLocal()
boolean isMember() throws JavaModelException
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.boolean isResolved()
ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException
input
- stream where hierarchy will be readmonitor
- the given progress monitorJavaModelException
- if the hierarchy could not be restored, reasons include:
- type is not the focus of the hierarchy or
- unable to read the input stream (wrong format, IOException during reading, ...)ITypeHierarchy.store(java.io.OutputStream, IProgressMonitor)
ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException
monitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException
Note that passing an empty working copy will be as if the original compilation unit had been deleted.
workingCopies
- the working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException
newSupertypeHierarchy(ICompilationUnit[], IProgressMonitor)
insteadNote that passing an empty working copy will be as if the original compilation unit had been deleted.
workingCopies
- the working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
owner
- the owner of working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException
project
- the given projectmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
project
- the given projectowner
- the owner of working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(IProgressMonitor monitor) throws JavaModelException
monitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException
Note that passing an empty working copy will be as if the original compilation unit had been deleted.
workingCopies
- the working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException
newTypeHierarchy(ICompilationUnit[], IProgressMonitor)
insteadNote that passing an empty working copy will be as if the original compilation unit had been deleted.
workingCopies
- the working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
owner
- the owner of working copies that take precedence over their original compilation unitsmonitor
- the given progress monitorJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.String[][] resolveType(String typeName) throws JavaModelException
Multiple answers might be found in case there are ambiguous matches.
Each matching type name is decomposed as an array of two strings, the first denoting the package name (dot-separated) and the second being the type name. The package name is empty if it is the default package. The type name is the type qualified name using a '.' enclosing type separator.
Returns null
if unable to find any matching type.
For example, resolution of "Object"
would typically return
{{"java.lang", "Object"}}
. Another resolution that returns
{{"", "X.Inner"}}
represents the inner type Inner defined in type X in the
default package.
typeName
- the given type namenull
if unable to find any matching typeJavaModelException
- if code resolve could not be performed.getTypeQualifiedName(char)
String[][] resolveType(String typeName, WorkingCopyOwner owner) throws JavaModelException
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
Multiple answers might be found in case there are ambiguous matches.
Each matching type name is decomposed as an array of two strings, the first denoting the package name (dot-separated) and the second being the type name. The package name is empty if it is the default package. The type name is the type qualified name using a '.' enclosing type separator.
Returns null
if unable to find any matching type.
For example, resolution of "Object"
would typically return
{{"java.lang", "Object"}}
. Another resolution that returns
{{"", "X.Inner"}}
represents the inner type Inner defined in type X in the
default package.
typeName
- the given type nameowner
- the owner of working copies that take precedence over their original compilation unitsnull
if unable to find any matching typeJavaModelException
- if code resolve could not be performed.getTypeQualifiedName(char)
boolean isLambda()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.