public class SourceType extends NamedMember implements IType
IType| Modifier and Type | Field and Description |
|---|---|
int |
localOccurrenceCount |
nameoccurrenceCountJEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_DELIMITER_ESCAPE, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LAMBDA_EXPRESSION, JEM_LAMBDA_METHOD, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, parentANNOTATION, 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 | Constructor and Description |
|---|---|
protected |
SourceType(JavaElement parent,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closing(java.lang.Object info)
This element is being closed.
|
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,
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(java.lang.String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a field in this type with the
given contents.
|
IInitializer |
createInitializer(java.lang.String contents,
IJavaElement sibling,
IProgressMonitor monitor)
Creates and returns a static initializer in this type with the
given contents.
|
IMethod |
createMethod(java.lang.String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a method or constructor in this type with the
given contents.
|
IType |
createType(java.lang.String contents,
IJavaElement sibling,
boolean force,
IProgressMonitor monitor)
Creates and returns a type in this type with the
given contents.
|
boolean |
equals(java.lang.Object o)
Returns true if this handle represents the same Java element
as the given handle.
|
IMethod[] |
findMethods(IMethod method)
Finds the methods in this type that correspond to
the given method.
|
IAnnotation[] |
getAnnotations()
Returns the annotations for this element.
|
IJavaElement[] |
getChildrenForCategory(java.lang.String category)
Returns the children of this type that have the given category as a
@category tag. |
IType |
getDeclaringType()
Returns the type in which this member is declared, or
null
if this member is not declared in a type (for example, a top-level type). |
int |
getElementType()
Returns this element's kind encoded as an integer.
|
IField |
getField(java.lang.String fieldName)
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.
|
java.lang.String |
getFullyQualifiedName()
Returns the fully qualified name of this type,
including qualification for any containing types and packages.
|
java.lang.String |
getFullyQualifiedName(char enclosingTypeSeparator)
Returns the fully qualified name of this type,
including qualification for any containing types and packages.
|
java.lang.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.
|
IJavaElement |
getHandleFromMemento(java.lang.String token,
MementoTokenizer memento,
WorkingCopyOwner workingCopyOwner) |
IInitializer |
getInitializer(int count)
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.
|
java.lang.String |
getKey()
Returns the binding key for this type only if the given type is
resolved. |
IMethod |
getMethod(java.lang.String selector,
java.lang.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.
|
protected java.lang.String |
getOccurrenceCountSignature() |
IPackageFragment |
getPackageFragment()
Returns the package fragment in which this element is defined.
|
IJavaElement |
getPrimaryElement(boolean checkOwner) |
java.lang.String |
getSuperclassName()
Returns the name of this type's superclass, or
null
for source types that do not specify a superclass. |
java.lang.String |
getSuperclassTypeSignature()
Returns the type signature of this type's superclass, or
null if none. |
java.lang.String[] |
getSuperInterfaceNames()
Returns the names of interfaces that this type implements or extends,
in the order in which they are listed in the source.
|
java.lang.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(java.lang.String typeName)
Returns the member type declared in this type with the given simple name.
|
ITypeParameter |
getTypeParameter(java.lang.String typeParameterName)
Returns the type parameter declared in this type with the given name.
|
ITypeParameter[] |
getTypeParameters()
Returns the formal type parameters for this type.
|
java.lang.String[] |
getTypeParameterSignatures()
Returns the formal type parameter signatures for this type.
|
java.lang.String |
getTypeQualifiedName()
Returns the type-qualified name of this type,
including qualification for any enclosing types,
but not including package qualification.
|
java.lang.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(java.io.InputStream input,
IProgressMonitor monitor)
Loads a previously saved ITypeHierarchy from an input stream.
|
ITypeHierarchy |
loadTypeHierachy(java.io.InputStream input,
WorkingCopyOwner owner,
IProgressMonitor monitor)
NOTE: This method is not part of the API has it is not clear clients would easily use it: they would need to
first make sure all working copies for the given owner exist before calling it.
|
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.
|
JavaElement |
resolved(Binding binding) |
protected void |
toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
Debugging purposes
|
getElementName, getFullyQualifiedName, getFullyQualifiedParameterizedName, getKey, getKey, getKey, getTypeQualifiedName, resolveType, resolveTypeareSimilarMethods, convertConstant, findMethods, getCategories, getClassFile, getFlags, getHandleMementoDelimiter, getJavadocRange, getNameRange, getOuterMostLocalContext, getType, getTypeRoot, isBinary, isMainMethod, isReadOnly, readableNamecopy, createElementInfo, delete, findNode, generateInfos, getAnnotation, getCompilationUnit, getCorrespondingResource, getHandleMemento, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getSourceRange, getUnderlyingResource, hasChildren, isStructureKnown, move, rename, resource, toStringNameappendEscapedDelimiter, close, escapeMementoName, exists, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hashCode, isAncestorOf, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetElementName, resolveType, resolveTypegetCategories, getClassFile, getCompilationUnit, getFlags, getJavadocRange, getOccurrenceCount, getType, getTypeRoot, isBinaryexists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnownexists, getNameRange, getSource, getSourceRangecopy, delete, move, renamegetChildren, hasChildrengetAnnotationprotected SourceType(JavaElement parent, java.lang.String name)
protected void closing(java.lang.Object info)
throws JavaModelException
SourceRefElementclosing in class SourceRefElementJavaModelExceptionpublic void codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
ICompletionRequestor requestor)
throws JavaModelException
ITypecodeComplete in interface ITypesnippet - 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.ITypepublic void codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
ICompletionRequestor requestor,
WorkingCopyOwner owner)
throws JavaModelException
ITypeNote 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.
codeComplete in interface ITypesnippet - 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.ITypepublic void codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor)
throws JavaModelException
ITypecodeComplete in interface ITypesnippet - 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.ITypepublic void codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor,
IProgressMonitor monitor)
throws JavaModelException
IType
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();
}
...
};
codeComplete in interface ITypesnippet - 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.ITypepublic void codeComplete(char[] snippet,
int insertion,
int position,
char[][] localVariableTypeNames,
char[][] localVariableNames,
int[] localVariableModifiers,
boolean isStatic,
CompletionRequestor requestor,
WorkingCopyOwner owner,
IProgressMonitor monitor)
throws JavaModelException
ITypeNote 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();
}
...
};
codeComplete in interface ITypesnippet - 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.ITypepublic IField createField(java.lang.String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
ITypeOptionally, 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 throwncreateField in interface ITypecontents - 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
ITypepublic IInitializer createInitializer(java.lang.String contents, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException
ITypeOptionally, 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.
createInitializer in interface ITypecontents - 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
ITypepublic IMethod createMethod(java.lang.String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
ITypeOptionally, 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 throwncreateMethod in interface ITypecontents - 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
ITypepublic IType createType(java.lang.String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException
ITypeOptionally, 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 throwncreateType in interface ITypecontents - 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
ITypepublic boolean equals(java.lang.Object o)
JavaElementIf a subclass has other requirements for equality, this method must be overridden.
equals in class SourceRefElementObject.equals(java.lang.Object)public IMethod[] findMethods(IMethod method)
ITypefindMethods in interface ITypemethod - the given methodnull if no such methods can be found.public IAnnotation[] getAnnotations() throws JavaModelException
IAnnotatablegetAnnotations in interface IAnnotatablegetAnnotations in class SourceRefElementJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public IJavaElement[] getChildrenForCategory(java.lang.String category) throws JavaModelException
IType@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.
getChildrenForCategory in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public IType getDeclaringType()
IMembernull
if this member is not declared in a type (for example, a top-level type).
This is a handle-only method.getDeclaringType in interface IMembergetDeclaringType in class Membernull
if this member is not declared in a type (for example, a top-level type)IMemberpublic int getElementType()
IJavaElementgetElementType in interface IJavaElementIJavaElementIJavaElementpublic IField getField(java.lang.String fieldName)
IType"bar").
This is a handle-only method. The field may or may not exist.getField in interface ITypefieldName - the given nameIType.getField(java.lang.String)public IField[] getFields() throws JavaModelException
ITypegetFields in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic java.lang.String getFullyQualifiedName()
IType'.',
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.getFullyQualifiedName in interface ITypeIType.getFullyQualifiedName()public java.lang.String getFullyQualifiedName(char enclosingTypeSeparator)
IType'.',
followed by the type-qualified name using the enclosingTypeSeparator.
For example:
getFullyQualifiedName in interface ITypeenclosingTypeSeparator - the given enclosing type separatorIType.getFullyQualifiedName(char)public java.lang.String getFullyQualifiedParameterizedName()
throws JavaModelException
ITypegetFullyQualifiedParameterizedName in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.protected java.lang.String getOccurrenceCountSignature()
getOccurrenceCountSignature in class NamedMemberpublic IJavaElement getHandleFromMemento(java.lang.String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner)
getHandleFromMemento in class Memberpublic IInitializer getInitializer(int count)
ITypegetInitializer in interface ITypecount - the specified positionITypepublic IInitializer[] getInitializers() throws JavaModelException
ITypegetInitializers in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic java.lang.String getKey()
ITyperesolved.
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.
getKey in interface ITypeIBinding.getKey(),
BindingKey,
IType.isResolved()public IMethod getMethod(java.lang.String selector, java.lang.String[] parameterTypeSignatures)
IType"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.
getMethod in interface ITypeselector - the given nameparameterTypeSignatures - the given parameter typesIType.getMethod(java.lang.String, java.lang.String[])public IMethod[] getMethods() throws JavaModelException
IType<clinit> method
and synthetic methods.
The results are listed in the order in which they appear in the source or class file.
getMethods in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic IPackageFragment getPackageFragment()
ITypegetPackageFragment in interface ITypegetPackageFragment in class NamedMemberITypepublic IJavaElement getPrimaryElement(boolean checkOwner)
getPrimaryElement in class JavaElementpublic java.lang.String getSuperclassName()
throws JavaModelException
ITypenull
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.
getSuperclassName in interface ITypenull 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.ITypepublic java.lang.String getSuperclassTypeSignature()
throws JavaModelException
ITypenull 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.
getSuperclassTypeSignature in interface ITypenull if noneJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.getSuperclassTypeSignature()public java.lang.String[] getSuperInterfaceNames()
throws JavaModelException
IType
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.
getSuperInterfaceNames in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic java.lang.String[] getSuperInterfaceTypeSignatures()
throws JavaModelException
ITypeFor 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.
getSuperInterfaceTypeSignatures in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.getSuperInterfaceTypeSignatures()public ITypeParameter[] getTypeParameters() throws JavaModelException
ITypegetTypeParameters in interface ITypegetTypeParameters in class NamedMemberJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public java.lang.String[] getTypeParameterSignatures()
throws JavaModelException
IType
The formal type parameter signatures may be either unresolved (for source
types) or resolved (for binary types). See Signature for details.
getTypeParameterSignatures in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.getTypeParameterSignatures()public IType getType(java.lang.String typeName)
ITypepublic ITypeParameter getTypeParameter(java.lang.String typeParameterName)
ITypegetTypeParameter in interface ITypetypeParameterName - the given simple namepublic java.lang.String getTypeQualifiedName()
IType'$', 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 in interface ITypeIType.getTypeQualifiedName()public java.lang.String getTypeQualifiedName(char enclosingTypeSeparator)
ITypeenclosingTypeSeparator, 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:
getTypeQualifiedName in interface ITypeenclosingTypeSeparator - the specified enclosing type separatorIType.getTypeQualifiedName(char)public IType[] getTypes() throws JavaModelException
ITypegetTypes in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic boolean isAnonymous()
ITypeisAnonymous in interface ITypeIType.isAnonymous()public boolean isClass()
throws JavaModelException
ITypeNote that a class can neither be an interface, an enumeration class, nor an annotation type.
isClass in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic boolean isEnum()
throws JavaModelException
ITypeNote that an enumeration class can neither be a class, an interface, nor an annotation type.
isEnum in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.isEnum()public boolean isInterface()
throws JavaModelException
ITypeNote that an interface can also be an annotation type, but it can neither be a class nor an enumeration class.
isInterface in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic boolean isAnnotation()
throws JavaModelException
ITypeNote that an annotation type is also an interface, but it can neither be a class nor an enumeration class.
isAnnotation in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.isAnnotation()public boolean isLocal()
ITypeNote: This deviates from JLS3 14.3, which states that anonymous types are not local types since they do not have a name.
isLocal in interface ITypeIType.isLocal()public boolean isMember()
ITypeisMember in interface ITypeIType.isMember()public boolean isResolved()
ITypeisResolved in interface ITypepublic ITypeHierarchy loadTypeHierachy(java.io.InputStream input, IProgressMonitor monitor) throws JavaModelException
ITypeloadTypeHierachy in interface ITypeinput - 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, ...)ITypepublic ITypeHierarchy loadTypeHierachy(java.io.InputStream input, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
Loads a previously saved ITypeHierarchy from an input stream. A type hierarchy can be stored using ITypeHierachy#store(OutputStream). A compilation unit of a loaded type has the given owner if such a working copy exists, otherwise the type's compilation unit is a primary compilation unit. Only hierarchies originally created by the following methods can be loaded:
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)public ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException
ITypenewSupertypeHierarchy in interface ITypemonitor - the given progress monitorJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException
ITypeNote that passing an empty working copy will be as if the original compilation unit had been deleted.
newSupertypeHierarchy in interface ITypeworkingCopies - 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.public ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException
ITypeNote that passing an empty working copy will be as if the original compilation unit had been deleted.
newSupertypeHierarchy in interface ITypeworkingCopies - 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.IType.newSupertypeHierarchy(IWorkingCopy[], IProgressMonitor)public ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
ITypeNote that if a working copy is empty, it will be as if the original compilation unit had been deleted.
newSupertypeHierarchy in interface ITypeowner - 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.IType.newSupertypeHierarchy(WorkingCopyOwner, IProgressMonitor)public ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException
ITypenewTypeHierarchy in interface ITypeproject - the given projectmonitor - the given progress monitorJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic ITypeHierarchy newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
ITypeNote that if a working copy is empty, it will be as if the original compilation unit had been deleted.
newTypeHierarchy in interface ITypeproject - 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.IType.newTypeHierarchy(IJavaProject, WorkingCopyOwner, IProgressMonitor)public ITypeHierarchy newTypeHierarchy(IProgressMonitor monitor) throws JavaModelException
ITypenewTypeHierarchy in interface ITypemonitor - the given progress monitorJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypepublic ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException
ITypeNote that passing an empty working copy will be as if the original compilation unit had been deleted.
newTypeHierarchy in interface ITypeworkingCopies - 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.public ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException
ITypeNote that passing an empty working copy will be as if the original compilation unit had been deleted.
newTypeHierarchy in interface ITypeworkingCopies - 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.IType.newTypeHierarchy(IWorkingCopy[], IProgressMonitor)public ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
ITypeNote that if a working copy is empty, it will be as if the original compilation unit had been deleted.
newTypeHierarchy in interface ITypeowner - 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.IType.newTypeHierarchy(WorkingCopyOwner, IProgressMonitor)public JavaElement resolved(Binding binding)
resolved in class JavaElementprotected void toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
JavaElementtoStringInfo in class JavaElementshowResolvedInfo - TODO