| org.eclipse.jdt.core.IType
All known Subclasses: org.eclipse.jdt.internal.core.BinaryType, org.eclipse.jdt.internal.core.SourceType,
IType | public interface IType extends IMember(Code) | | Represents either a source type in a compilation unit (either a top-level
type, a member type, a local type or an anonymous type)
or a binary type in a class file. Enumeration classes and annotation
types are subkinds of classes and interfaces, respectively.
Note that the element name of an anonymous source type is always empty.
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.
This interface is not intended to be implemented by clients.
|
Method Summary | |
void | codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor) Do code completion inside a code snippet in the context of the current type.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. | void | codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner) Do code completion inside a code snippet in the context of the current type.
It considers types in the working copies with the given owner first. | 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.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. | 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.
It considers types in the working copies with the given owner first. | IField | createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) Creates and returns a field in this type with the
given contents.
Optionally, the new element can be positioned before the specified
sibling. | IInitializer | createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor) Creates and returns a static initializer in this type with the
given contents.
Optionally, the new element can be positioned before the specified
sibling. | IMethod | createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) Creates and returns a method or constructor in this type with the
given contents.
Optionally, the new element can be positioned before the specified
sibling. | IType | createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) Creates and returns a type in this type with the
given contents.
Optionally, the new type can be positioned before the specified
sibling. | 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" ).
This is a handle-only method. | IField[] | getFields() Returns the fields declared by this type.
If this is a source type, the results are listed in the order
in which they appear in the source, otherwise, the results are
in no particular order. | 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 followed by its type parameters between angle brakets if it is a generic type.
For example, "p.X<T>", "java.util.Map<java.lang.String, p.X>"
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | IInitializer | getInitializer(int occurrenceCount) Returns the initializer with the specified position relative to
the order they are defined in the source.
Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
This is a handle-only method. | IInitializer[] | getInitializers() Returns the initializers declared by this type.
For binary types this is an empty collection.
If this is a source type, the results are listed in the order
in which they appear in the source.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | String | getKey() Returns the binding key for this type. | IMethod | getMethod(String name, String[] parameterTypeSignatures) Returns the method with the specified name and parameter types
in this type (for example, "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. | IMethod[] | getMethods() Returns the methods and constructors declared by this type.
For binary types, this may include the special <clinit> ; method
and synthetic methods.
If this is a source type, the results are listed in the order
in which they appear in the source, otherwise, the results are
in no particular order.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | IPackageFragment | getPackageFragment() Returns the package fragment in which this element is defined. | String[] | getSuperInterfaceNames() Returns the names of interfaces that this type implements or extends,
in the order in which they are listed in the source.
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. | 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.
For classes and enum types, this gives the interfaces that this
class implements. | String | getSuperclassName() Returns the name of this type's superclass, or 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
IType.getSuperclassTypeSignature() which returns
a structured type signature string containing more precise information.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | String | getSuperclassTypeSignature() Returns the type signature of this type's superclass, or
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). | IType | getType(String name) Returns the member type declared in this type with the given simple name.
This is a handle-only method. | ITypeParameter | getTypeParameter(String name) Returns the type parameter declared in this type with the given name.
This is a handle-only method. | String[] | getTypeParameterSignatures() Returns the formal type parameter signatures for this type.
Returns an empty array if this type has no formal type parameters.
The formal type parameter signatures may be either unresolved (for source
types) or resolved (for binary types). | ITypeParameter[] | getTypeParameters() Returns the formal type parameters for this type.
Returns an empty array if this type has no formal type parameters.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | 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.
The results are listed in the order in which they appear in the source or class file.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isAnnotation() Returns whether this type represents an annotation type.
Note that an annotation type is also an interface, but it can neither be a class nor an enumeration class. | boolean | isAnonymous() Returns whether this type represents an anonymous type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isClass() Returns whether this type represents a class.
Note that a class can neither be an interface, an enumeration class, nor an annotation type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isEnum() Returns whether this type represents an enumeration class.
Note that an enumeration class can neither be a class, an interface, nor an annotation type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isInterface() Returns whether this type represents an interface.
Note that an interface can also be an annotation type, but it can neither be a class nor an enumeration class.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isLocal() Returns whether this type represents a local type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | boolean | isMember() Returns whether this type represents a member type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | 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(IProgressMonitor monitor) Creates and returns a type hierarchy for this type containing
this type and all of its supertypes.
Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | 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(IWorkingCopy[] 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(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(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.
Parameters: project - the given project Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | 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.
Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. | 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(IWorkingCopy[] 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(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. |
codeComplete | void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor) throws JavaModelException(Code) | | Do code completion inside a code snippet in the context of the current type.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. Otherwise the completion is performed
against type structure and given locals variables.
Parameters: snippet - the code snippet Parameters: insertion - the position with in source where the snippetis inserted. This position must not be in comments.A possible value is -1, if the position is not known. Parameters: position - the position within snippet where the user is performing code assist. Parameters: localVariableTypeNames - an array (possibly empty) of fully qualified type names of local variables visible at the current scope Parameters: localVariableNames - an array (possibly empty) of local variable names that are visible at the current scope Parameters: localVariableModifiers - an array (possible empty) of modifiers for local variables Parameters: isStatic - whether the current scope is in a static context Parameters: requestor - the completion requestor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 2.0IType.codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor) |
codeComplete | void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException(Code) | | Do code completion inside a code snippet in the context of the current type.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original compilation units
in the workspace.
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. Otherwise the completion is performed
against type structure and given locals variables.
Parameters: snippet - the code snippet Parameters: insertion - the position with in source where the snippetis inserted. This position must not be in comments.A possible value is -1, if the position is not known. Parameters: position - the position with in snippet where the user is performing code assist. Parameters: localVariableTypeNames - an array (possibly empty) of fully qualified type names of local variables visible at the current scope Parameters: localVariableNames - an array (possibly empty) of local variable names that are visible at the current scope Parameters: localVariableModifiers - an array (possible empty) of modifiers for local variables Parameters: isStatic - whether the current scope is in a static context Parameters: requestor - the completion requestor Parameters: owner - the owner of working copies that take precedence over their original compilation units exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.0IType.codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor,WorkingCopyOwner) |
codeComplete | void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor) throws JavaModelException(Code) | | Do code completion inside a code snippet in the context of the current type.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. Otherwise the completion is performed
against type structure and given locals variables.
Parameters: snippet - the code snippet Parameters: insertion - the position with in source where the snippetis inserted. This position must not be in comments.A possible value is -1, if the position is not known. Parameters: position - the position within snippet where the user is performing code assist. Parameters: localVariableTypeNames - an array (possibly empty) of fully qualified type names of local variables visible at the current scope Parameters: localVariableNames - an array (possibly empty) of local variable names that are visible at the current scope Parameters: localVariableModifiers - an array (possible empty) of modifiers for local variables Parameters: isStatic - whether the current scope is in a static context Parameters: requestor - the completion requestor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.1 |
codeComplete | void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException(Code) | | Do code completion inside a code snippet in the context of the current type.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original compilation units
in the workspace.
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
If the type can access to his source code and the insertion position is valid,
then completion is performed against source. Otherwise the completion is performed
against type structure and given locals variables.
Parameters: snippet - the code snippet Parameters: insertion - the position with in source where the snippetis inserted. This position must not be in comments.A possible value is -1, if the position is not known. Parameters: position - the position with in snippet where the user is performing code assist. Parameters: localVariableTypeNames - an array (possibly empty) of fully qualified type names of local variables visible at the current scope Parameters: localVariableNames - an array (possibly empty) of local variable names that are visible at the current scope Parameters: localVariableModifiers - an array (possible empty) of modifiers for local variables Parameters: isStatic - whether the current scope is in a static context Parameters: requestor - the completion requestor Parameters: owner - the owner of working copies that take precedence over their original compilation units exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.1 |
createField | IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a field in this type with the
given contents.
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 effects the resolution of
such a conflict:
-
true - in this case the field is created with the new contents
-
false - in this case a JavaModelException is thrown
Parameters: contents - the given contents Parameters: sibling - the given sibling Parameters: force - a flag in case the same name already exists in this type Parameters: monitor - the given progress monitor exception: JavaModelException - if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException occurred while updating an underlying resource - The specified sibling is not a child of this type (INVALID_SIBLING)
- The contents could not be recognized as a field declaration (INVALID_CONTENTS)
- This type is read-only (binary) (READ_ONLY)
- There was a naming collision with an existing field (NAME_COLLISION)
a field in this type with the given contents |
createInitializer | IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a static initializer in this type with the
given contents.
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.
Parameters: contents - the given contents Parameters: sibling - the given sibling Parameters: monitor - the given progress monitor exception: JavaModelException - if the element could not be created. Reasons include:- This element does not exist
- A
CoreException occurred while updating an underlying resource - The specified sibling is not a child of this type (INVALID_SIBLING)
- The contents could not be recognized as an initializer declaration (INVALID_CONTENTS)
- This type is read-only (binary) (READ_ONLY)
a static initializer in this type with the given contents |
createMethod | IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a method or constructor in this type with the
given contents.
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 effects the resolution of
such a conflict:
-
true - in this case the method is created with the new contents
-
false - in this case a JavaModelException is thrown
Parameters: contents - the given contents Parameters: sibling - the given sibling Parameters: force - a flag in case the same name already exists in this type Parameters: monitor - the given progress monitor exception: JavaModelException - if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException occurred while updating an underlying resource - The specified sibling is not a child of this type (INVALID_SIBLING)
- The contents could not be recognized as a method or constructordeclaration (INVALID_CONTENTS)
- This type is read-only (binary) (READ_ONLY)
- There was a naming collision with an existing method (NAME_COLLISION)
a method or constructor in this type with the given contents |
createType | IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a type in this type with the
given contents.
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 effects the resolution of
such a conflict:
-
true - in this case the type is created with the new contents
-
false - in this case a JavaModelException is thrown
Parameters: contents - the given contents Parameters: sibling - the given sibling Parameters: force - a flag in case the same name already exists in this type Parameters: monitor - the given progress monitor exception: JavaModelException - if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException occurred while updating an underlying resource - The specified sibling is not a child of this type (INVALID_SIBLING)
- The contents could not be recognized as a type declaration (INVALID_CONTENTS)
- This type is read-only (binary) (READ_ONLY)
- There was a naming collision with an existing field (NAME_COLLISION)
a type in this type with the given contents |
findMethods | IMethod[] findMethods(IMethod method)(Code) | | Finds the methods in this type that correspond to
the given method.
A method m1 corresponds to another method m2 if:
- m1 has the same element name as m2.
- m1 has the same number of arguments as m2 and
the simple names of the argument types must be equals.
- m1 exists.
Parameters: method - the given method the found method or null if no such methods can be found. since: 2.0 |
getChildrenForCategory | IJavaElement[] getChildrenForCategory(String category) throws JavaModelException(Code) | | Returns the children of this type that have the given category as a @category tag.
Returns an empty array if no children with this category exist.
the children for the given category. exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.2 |
getElementName | String getElementName()(Code) | | Returns the simple name of this type, unqualified by package or enclosing type.
This is a handle-only method.
the simple name of this type |
getField | IField getField(String name)(Code) | | Returns the field with the specified name
in this type (for example, "bar" ).
This is a handle-only method. The field may or may not exist.
Parameters: name - the given name the field with the specified name in this type |
getFields | IField[] getFields() throws JavaModelException(Code) | | Returns the fields declared by this type.
If this is a source type, the results are listed in the order
in which they appear in the source, otherwise, the results are
in no particular order. For binary types, this includes synthetic fields.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the fields declared by this type |
getFullyQualifiedName | String getFullyQualifiedName()(Code) | | Returns the fully qualified name of this type,
including qualification for any containing types and packages.
This is the name of the package, followed by '.' ,
followed by the type-qualified name.
This is a handle-only method.
See Also: IType.getTypeQualifiedName the fully qualified name of this type |
getFullyQualifiedName | String getFullyQualifiedName(char enclosingTypeSeparator)(Code) | | Returns the fully qualified name of this type,
including qualification for any containing types and packages.
This is the name of the package, followed by '.' ,
followed by the type-qualified name using the enclosingTypeSeparator .
For example:
- the fully qualified name of a class B defined as a member of a class A in a compilation unit A.java
in a package x.y using the '.' separator is "x.y.A.B"
- the fully qualified name of a class B defined as a member of a class A in a compilation unit A.java
in a package x.y using the '$' separator is "x.y.A$B"
- the fully qualified name of a binary type whose class file is x/y/A$B.class
using the '.' separator is "x.y.A.B"
- the fully qualified name of a binary type whose class file is x/y/A$B.class
using the '$' separator is "x.y.A$B"
- the fully qualified name of an anonymous binary type whose class file is x/y/A$1.class
using the '.' separator is "x.y.A$1"
This is a handle-only method.
Parameters: enclosingTypeSeparator - the given enclosing type separator the fully qualified name of this type, including qualification for any containing types and packages See Also: IType.getTypeQualifiedName(char) since: 2.0 |
getFullyQualifiedParameterizedName | String getFullyQualifiedParameterizedName() throws JavaModelException(Code) | | Returns this type's fully qualified name followed by its type parameters between angle brakets if it is a generic type.
For example, "p.X<T>", "java.util.Map<java.lang.String, p.X>"
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the fully qualified parameterized representation of this type since: 3.1 |
getInitializer | IInitializer getInitializer(int occurrenceCount)(Code) | | Returns the initializer with the specified position relative to
the order they are defined in the source.
Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
This is a handle-only method. The initializer may or may not be present.
Parameters: occurrenceCount - the specified position the initializer with the specified position relative to the order they are defined in the source |
getInitializers | IInitializer[] getInitializers() throws JavaModelException(Code) | | Returns the initializers declared by this type.
For binary types this is an empty collection.
If this is a source type, the results are listed in the order
in which they appear in the source.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the initializers declared by this type |
getMethod | IMethod getMethod(String name, String[] parameterTypeSignatures)(Code) | | Returns the method with the specified name and parameter types
in this type (for example, "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.
Parameters: name - the given name Parameters: parameterTypeSignatures - the given parameter types the method with the specified name and parameter types in this type |
getMethods | IMethod[] getMethods() throws JavaModelException(Code) | | Returns the methods and constructors declared by this type.
For binary types, this may include the special <clinit> ; method
and synthetic methods.
If this is a source type, the results are listed in the order
in which they appear in the source, otherwise, the results are
in no particular order.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the methods and constructors declared by this type |
getPackageFragment | IPackageFragment getPackageFragment()(Code) | | Returns the package fragment in which this element is defined.
This is a handle-only method.
the package fragment in which this element is defined |
getSuperInterfaceNames | String[] getSuperInterfaceNames() throws JavaModelException(Code) | | Returns the names of interfaces that this type implements or extends,
in the order in which they are listed in the source.
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
IType.getSuperInterfaceTypeSignatures() which returns
structured signature strings containing more precise information.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the names of interfaces that this type implements or extends, in the order in which they are listed in the source, an empty collection if none |
getSuperInterfaceTypeSignatures | String[] getSuperInterfaceTypeSignatures() throws JavaModelException(Code) | | Returns the type signatures of the interfaces that this type
implements or extends, in the order in which they are listed in the
source.
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.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the type signatures of interfaces that this type implementsor extends, in the order in which they are listed in the source, an empty collection if none since: 3.0 |
getSuperclassName | String getSuperclassName() throws JavaModelException(Code) | | Returns the name of this type's superclass, or 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
IType.getSuperclassTypeSignature() which returns
a structured type signature string containing more precise information.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the name of this type's superclass, or null for source types that do not specify a superclass |
getSuperclassTypeSignature | String getSuperclassTypeSignature() throws JavaModelException(Code) | | Returns the type signature of this type's superclass, or
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.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the type signature of this type's superclass, ornull if none since: 3.0 |
getType | IType getType(String name)(Code) | | Returns the member type declared in this type with the given simple name.
This is a handle-only method. The type may or may not exist.
Parameters: name - the given simple name the member type declared in this type with the given simple name |
getTypeParameter | ITypeParameter getTypeParameter(String name)(Code) | | Returns the type parameter declared in this type with the given name.
This is a handle-only method. The type parameter may or may not exist.
Parameters: name - the given simple name the type parameter declared in this type with the given name since: 3.1 |
getTypeParameterSignatures | String[] getTypeParameterSignatures() throws JavaModelException(Code) | | Returns the formal type parameter signatures for this type.
Returns an empty array if this type has no formal type parameters.
The formal type parameter signatures may be either unresolved (for source
types) or resolved (for binary types). See
Signature for details.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the formal type parameter signatures of this type,in the order declared in the source, an empty array if none See Also: Signature since: 3.0 |
getTypeParameters | ITypeParameter[] getTypeParameters() throws JavaModelException(Code) | | Returns the formal type parameters for this type.
Returns an empty array if this type has no formal type parameters.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the formal type parameters of this type,in the order declared in the source, an empty array if none since: 3.1 |
getTypeQualifiedName | String getTypeQualifiedName()(Code) | | Returns the type-qualified name of this type,
including qualification for any enclosing types,
but not including package qualification.
For source types, this consists of the simple names of any enclosing types,
separated by '$' , followed by the simple name of this type
or the occurence count of this type if it is anonymous.
For binary types, this is the name of the class file without the ".class" suffix.
This is a handle-only method.
the type-qualified name of this type |
getTypeQualifiedName | String getTypeQualifiedName(char enclosingTypeSeparator)(Code) | | Returns the type-qualified name of this type,
including qualification for any enclosing types,
but not including package qualification.
For source types, this consists of the simple names of any enclosing types,
separated by enclosingTypeSeparator , followed by the
simple name of this type or the occurence count of this type if it is anonymous.
For binary types, this is the name of the class file without the ".class" suffix.
For example:
- the type qualified name of a class B defined as a member of a class A
using the '.' separator is "A.B"
- the type qualified name of a class B defined as a member of a class A
using the '$' separator is "A$B"
- the type qualified name of a binary type whose class file is A$B.class
using the '.' separator is "A$B"
- the type qualified name of a binary type whose class file is A$B.class
using the '$' separator is "A$B"
- the type qualified name of an anonymous binary type whose class file is A$1.class
using the '.' separator is "A$1"
This is a handle-only method.
Parameters: enclosingTypeSeparator - the specified enclosing type separator the type-qualified name of this type since: 2.0 |
getTypes | IType[] getTypes() throws JavaModelException(Code) | | Returns the immediate member types declared by this type.
The results are listed in the order in which they appear in the source or class file.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. the immediate member types declared by this type |
isAnnotation | boolean isAnnotation() throws JavaModelException(Code) | | Returns whether this type represents an annotation type.
Note that an annotation type is also an interface, but it can neither be a class nor an enumeration class.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents an annotation type,false otherwise since: 3.0 |
isAnonymous | boolean isAnonymous() throws JavaModelException(Code) | | Returns whether this type represents an anonymous type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents an anonymous type, false otherwise since: 2.0 |
isClass | boolean isClass() throws JavaModelException(Code) | | Returns whether this type represents a class.
Note that a class can neither be an interface, an enumeration class, nor an annotation type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents a class, false otherwise |
isEnum | boolean isEnum() throws JavaModelException(Code) | | Returns whether this type represents an enumeration class.
Note that an enumeration class can neither be a class, an interface, nor an annotation type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents an enumeration class,false otherwise since: 3.0 |
isInterface | boolean isInterface() throws JavaModelException(Code) | | Returns whether this type represents an interface.
Note that an interface can also be an annotation type, but it can neither be a class nor an enumeration class.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents an interface, false otherwise |
isLocal | boolean isLocal() throws JavaModelException(Code) | | Returns whether this type represents a local type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents a local type, false otherwise since: 2.0 |
isMember | boolean isMember() throws JavaModelException(Code) | | Returns whether this type represents a member type.
exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. true if this type represents a member type, false otherwise since: 2.0 |
isResolved | boolean isResolved()(Code) | | Returns whether this type represents a resolved type.
If a type is resolved, its key contains resolved information.
whether this type represents a resolved type. since: 3.1 |
loadTypeHierachy | ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException(Code) | | Loads a previously saved ITypeHierarchy from an input stream. A type hierarchy can
be stored using ITypeHierachy#store(OutputStream).
Only hierarchies originally created by the following methods can be loaded:
- IType#newSupertypeHierarchy(IProgressMonitor)
- IType#newTypeHierarchy(IJavaProject, IProgressMonitor)
- IType#newTypeHierarchy(IProgressMonitor)
Parameters: input - stream where hierarchy will be read Parameters: monitor - the given progress monitor the stored hierarchy exception: JavaModelException - 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, ...) See Also: ITypeHierarchy.store(java.io.OutputStreamIProgressMonitor) since: 2.1 |
newSupertypeHierarchy | ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a type hierarchy for this type containing
this type and all of its supertypes.
Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. a type hierarchy for this type containing this type and all of its supertypes |
newSupertypeHierarchy | ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a type hierarchy for this type containing
this type and all of its supertypes, considering types in the given
working copies. In other words, the list of working copies will take
precedence over their original compilation units in the workspace.
Note that passing an empty working copy will be as if the original compilation
unit had been deleted.
Parameters: workingCopies - the working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containing this type and all of its supertypes exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.0 |
newSupertypeHierarchy | ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a type hierarchy for this type containing
this type and all of its supertypes, considering types in the given
working copies. In other words, the list of working copies will take
precedence over their original compilation units in the workspace.
Note that passing an empty working copy will be as if the original compilation
unit had been deleted.
Parameters: workingCopies - the working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containing this type and all of its supertypes exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 2.0IType.newSupertypeHierarchy(ICompilationUnit[],IProgressMonitor) |
newSupertypeHierarchy | ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException(Code) | | 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.
In other words, the owner's working copies will take
precedence over their original compilation units in the workspace.
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
Parameters: owner - the owner of working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containing this type and all of its supertypes exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.0 |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException(Code) | | 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.
Parameters: project - the given project Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the context of the given project |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException(Code) | | 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.
In other words, the owner's working copies will take
precedence over their original compilation units in the workspace.
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
Parameters: project - the given project Parameters: owner - the owner of working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the context of the given project since: 3.0 |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(IProgressMonitor monitor) throws JavaModelException(Code) | | Creates and returns a type hierarchy for this type containing
this type, all of its supertypes, and all its subtypes in the workspace.
Parameters: monitor - the given progress monitor exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the workspace |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException(Code) | | 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. In other words, the list of working
copies that will take precedence over their original compilation units in the workspace.
Note that passing an empty working copy will be as if the original compilation
unit had been deleted.
Parameters: workingCopies - the working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the workspace exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.0 |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException(Code) | | 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. In other words, the list of working
copies that will take precedence over their original compilation units in the workspace.
Note that passing an empty working copy will be as if the original compilation
unit had been deleted.
Parameters: workingCopies - the working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the workspace exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 2.0IType.newTypeHierarchy(ICompilationUnit[],IProgressMonitor) |
newTypeHierarchy | ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException(Code) | | 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.
In other words, the owner's working copies will take
precedence over their original compilation units in the workspace.
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
Parameters: owner - the owner of working copies that take precedence over their original compilation units Parameters: monitor - the given progress monitor a type hierarchy for this type containingthis type, all of its supertypes, and all its subtypes in the workspace exception: JavaModelException - if this element does not exist or if anexception occurs while accessing its corresponding resource. since: 3.0 |
resolveType | String[][] resolveType(String typeName) throws JavaModelException(Code) | | Resolves the given type name within the context of this type (depending on the type hierarchy
and its imports).
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.
Parameters: typeName - the given type name exception: JavaModelException - if code resolve could not be performed. the resolved type names or null if unable to find any matching type See Also: IType.getTypeQualifiedName(char) |
resolveType | String[][] resolveType(String typeName, WorkingCopyOwner owner) throws JavaModelException(Code) | | 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. In other words, the owner's working copies will take
precedence over their original compilation units in the workspace.
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.
Parameters: typeName - the given type name Parameters: owner - the owner of working copies that take precedence over their original compilation units exception: JavaModelException - if code resolve could not be performed. the resolved type names or null if unable to find any matching type See Also: IType.getTypeQualifiedName(char) since: 3.0 |
|
|