public class BinaryType extends BinaryMember implements IType, SuffixConstants
IType| Modifier and Type | Field and Description |
|---|---|
static JavadocContents |
EMPTY_JAVADOC |
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_MODULAR_CLASSFILE, JEM_MODULE, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, NO_STRINGS, parentANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETEREXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, EXTENSION_jmod, EXTENSION_JMOD, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA| Modifier | Constructor and Description |
|---|---|
protected |
BinaryType(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.
|
java.lang.String |
getAttachedJavadoc(IProgressMonitor monitor)
Returns the Javadoc as HTML source if this element has attached Javadoc,
null otherwise. |
IJavaElement[] |
getChildren()
Returns the immediate children of this element.
|
IJavaElement[] |
getChildrenForCategory(java.lang.String category)
Returns the children of this type that have the given category as a
@category tag. |
IOrdinaryClassFile |
getClassFile()
Returns the class file in which this member is declared, or
null
if this member is not declared in a class file (for example, a source type). |
protected org.aspectj.org.eclipse.jdt.internal.core.ClassFileInfo |
getClassFileInfo() |
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). |
java.lang.Object |
getElementInfo(IProgressMonitor monitor)
Returns the info for this handle.
|
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.
|
int |
getFlags()
Returns the modifier flags for this member.
|
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.
|
JavadocContents |
getJavadocContents(IProgressMonitor monitor) |
java.lang.String |
getKey(boolean forceOpen) |
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.
|
IPackageFragment |
getPackageFragment()
Returns the package fragment in which this element is defined.
|
java.lang.String |
getSourceFileName(IBinaryType info) |
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 |
isRecord()
Returns whether this type represents a record class.
|
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) |
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)
Deprecated.
|
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) |
java.lang.String |
sourceFileName(IBinaryType info) |
protected void |
toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
Debugging purposes
|
protected void |
toStringName(java.lang.StringBuffer buffer)
Debugging purposes
|
copy, getAnnotations, getCategories, getKey, getNameRange, getSourceRange, getStandardAnnotations, isBinary, isStructureKnown, move, rename, setContentsgetElementName, getFullyQualifiedName, getFullyQualifiedParameterizedName, getKey, getKey, getKey, getKey, getOccurrenceCountSignature, getTypeQualifiedName, resolveType, resolveTypeareSimilarMethods, convertConstant, findMethods, getHandleMementoDelimiter, getJavadocRange, getOuterMostLocalContext, getType, getTypeRoot, isMainMethod, isReadOnly, readableNamecreateElementInfo, delete, findNode, generateInfos, getAnnotation, getCompilationUnit, getCorrespondingResource, getHandleMemento, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getUnderlyingResource, hasChildren, resourceappendEscapedDelimiter, close, escapeMementoName, exists, getAncestor, getChildrenOfType, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenable, getParent, getPrimaryElement, 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, getKey, resolveType, resolveTypegetCategories, getCompilationUnit, getJavadocRange, getOccurrenceCount, getType, getTypeRoot, isBinaryexists, getAncestor, getCorrespondingResource, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnownexists, getNameRange, getSource, getSourceRangecopy, delete, move, renamehasChildrengetAnnotationpublic static final JavadocContents EMPTY_JAVADOC
protected BinaryType(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.IType.codeComplete(char[], int, int, char[][], char[][], int[], boolean, ICompletionRequestor)public 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.IType.codeComplete(char[], int, int, char[][], char[][], int[], boolean, ICompletionRequestor, WorkingCopyOwner)public 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.public 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.public 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.public 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
public 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
public 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
public 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
public 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[] getChildren() throws JavaModelException
IParentgetChildren in interface IParentgetChildren in class JavaElementJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIParentpublic 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.protected org.aspectj.org.eclipse.jdt.internal.core.ClassFileInfo getClassFileInfo()
throws JavaModelException
JavaModelExceptionpublic IOrdinaryClassFile getClassFile()
IMembernull
if this member is not declared in a class file (for example, a source type).
This is a handle-only method.getClassFile in interface IMembergetClassFile in interface ITypegetClassFile in class Membernull
if this member is not declared in a class file (for example, a source type)IMemberpublic 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 java.lang.Object getElementInfo(IProgressMonitor monitor)
throws JavaModelException
JavaElementgetElementInfo in class JavaElementJavaModelException - if the element is not present or not accessiblepublic 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.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.public int getFlags()
throws JavaModelException
IMemberFlags.
For binary members, flags from the class file
as well as derived flags Flags.AccAnnotationDefault and Flags.AccDefaultMethod are included.
For source members, only flags as indicated in the source are returned. Thus if an interface
defines a method void myMethod();, the flags don't include the
'public' flag. Source flags include Flags.AccAnnotationDefault as well.
public 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.getTypeQualifiedName(),
IType.getFullyQualifiedName(char)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.getTypeQualifiedName(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.public IJavaElement getHandleFromMemento(java.lang.String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner)
getHandleFromMemento in class Memberpublic IInitializer getInitializer(int count)
ITypegetInitializer in interface ITypecount - the specified positionpublic IInitializer[] getInitializers()
ITypegetInitializers in interface ITypepublic java.lang.String getKey(boolean forceOpen)
throws JavaModelException
getKey in class BinaryMemberJavaModelExceptionBinding.computeUniqueKey()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.
Note that the parameter type signatures for binary methods are expected
to be dot-based.
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.public IPackageFragment getPackageFragment()
ITypegetPackageFragment in interface ITypegetPackageFragment in class NamedMemberpublic 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 getSourceFileName(IBinaryType info)
public 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.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.public 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(char)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 separatorpublic IType[] getTypes() throws JavaModelException
ITypegetTypes in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.public boolean isAnonymous()
throws JavaModelException
ITypeisAnonymous in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.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.public 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 isRecord()
throws JavaModelException
ITypeNote that a record class can neither be an enumeration, an interface, nor an annotation type.
isRecord in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IType.isRecord()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.public 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()
throws JavaModelException
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 ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.ITypeBinding.isLocal()public boolean isMember()
throws JavaModelException
ITypeisMember in interface ITypeJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.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, ...)ITypeHierarchy.store(java.io.OutputStream, IProgressMonitor)public ITypeHierarchy loadTypeHierachy(java.io.InputStream input, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
JavaModelExceptionpublic 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.public 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.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.public 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.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.IType.newTypeHierarchy(IProgressMonitor monitor)public 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.public JavaElement resolved(Binding binding)
resolved in class JavaElementpublic java.lang.String sourceFileName(IBinaryType info)
protected void toStringInfo(int tab,
java.lang.StringBuffer buffer,
java.lang.Object info,
boolean showResolvedInfo)
JavaElementtoStringInfo in class JavaElementshowResolvedInfo - TODOprotected void toStringName(java.lang.StringBuffer buffer)
JavaElementtoStringName in class SourceRefElementpublic java.lang.String getAttachedJavadoc(IProgressMonitor monitor)
throws JavaModelException
IJavaElementReturns the Javadoc as HTML source if this element has attached Javadoc,
null otherwise.
This should be used only for binary elements. Source elements will always return null.
The encoding used to read the Javadoc is the one defined by the content type of the file. If none is defined, then the project's encoding of this Java element is used. If the project's encoding cannot be retrieved, then the platform encoding is used.
In case the Javadoc doesn't exist for this element, null is returned.
The HTML is extracted from the attached Javadoc and provided as is. No transformation or validation is done.
getAttachedJavadoc in interface IJavaElementgetAttachedJavadoc in class JavaElementmonitor - the given progress monitor, can be nullnull if noneJavaModelException - if:IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAMEpublic JavadocContents getJavadocContents(IProgressMonitor monitor) throws JavaModelException
JavaModelException