Class SourceType
- All Implemented Interfaces:
IAnnotatable, IJavaElement, IMember, IParent, ISourceManipulation, ISourceReference, IType, org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
LambdaExpression, ResolvedSourceType
- See Also:
-
Field Summary
FieldsFields inherited from class NamedMember
nameFields inherited from class JavaElement
JEM_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_STRINGSModifier and TypeFieldDescriptionstatic final charstatic final charstatic final charstatic final charstatic final charBefore ')','&'and '"' became the newest additions as delimiters, the former two were allowed as part of element attributes and possibly stored.static final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charprotected static final JavaElement[]protected static final Objectstatic final String[]Fields inherited from interface IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETERModifier and TypeFieldDescriptionstatic final intConstant representing an annotation.static final intConstant representing a class file.static final intConstant representing a Java compilation unit.static final intConstant representing a field.static final intConstant representing all import declarations within a compilation unit.static final intConstant representing an import declaration within a compilation unit.static final intConstant representing a stand-alone instance or class initializer.static final intConstant representing a Java model (workspace level object).static final intConstant represents a module descriptor.static final intConstant representing a Java project.static final intConstant representing a local variable declaration.static final intConstant representing a method or constructor.static final intConstant representing a package declaration within a compilation unit.static final intConstant representing a package fragment.static final intConstant representing a package fragment root.static final intConstant representing a type (a class or interface).static final intConstant representing a type parameter declaration. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSourceType(JavaElement parent, String name) protectedSourceType(JavaElement parent, String name, int occurrenceCount) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis element is being closed.voidcodeComplete(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.voidcodeComplete(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.voidcodeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) Do code completion inside a code snippet in the context of the current type.voidcodeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) Do code completion inside a code snippet in the context of the current type.voidcodeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor) Deprecated.voidcodeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner) Deprecated.createField(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a field in this type with the given contents.createInitializer(String contents, IJavaElement sibling, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a static initializer in this type with the given contents.createMethod(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a method or constructor in this type with the given contents.createType(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a type in this type with the given contents.booleanReturns 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.Returns the annotations for this element.getChildrenForCategory(String category) Returns the children of this type that have the given category as a@categorytag.Returns the class file in which this member is declared, ornullif this member is not declared in a class file (for example, a source type).Returns the type in which this member is declared, ornullif this member is not declared in a type (for example, a top-level type).intReturns this element's kind encoded as an integer.Returns the field with the specified name in this type (for example,"bar").IField[]Returns the fields declared by this type in the order in which they appear in the source or class file.Returns the fully qualified name of this type, including qualification for any containing types and packages.getFullyQualifiedName(char enclosingTypeSeparator) Returns the fully qualified name of this type, including qualification for any containing types and packages.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.getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) getInitializer(int count) Returns the initializer with the specified position relative to the order they are defined in the source.Returns the initializers declared by this type.getKey()Returns the binding key for this type only if the given type isresolved.Returns the method with the specified name and parameter types in this type (for example,"foo", {"I", "QString;"}).IMethod[]Returns the methods and constructors declared by this type.protected StringReturns the package fragment in which this element is defined.String[]Returns the names of types that this sealed type permits to be its subtypes.getPrimaryElement(boolean checkOwner) getRecordComponent(String compName) Returns the record component with the specified name in this type (for example,"bar").IField[]Returns the record components declared by this record class, or an empty array if this is not a record.Returns the name of this type's superclass, ornullfor source types that do not specify a superclass.Returns the type signature of this type's superclass, ornullif none.String[]Returns the names of interfaces that this type implements or extends, in the order in which they are listed in the source.String[]Returns the type signatures of the interfaces that this type implements or extends, in the order in which they are listed in the source.Returns the member type declared in this type with the given simple name.getTypeParameter(String typeParameterName) Returns the type parameter declared in this type with the given name.Returns the formal type parameters for this type.String[]Returns the formal type parameter signatures for this type.Returns the type-qualified name of this type, including qualification for any enclosing types, but not including package qualification.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.booleanReturns whether this type represents an annotation type.booleanReturns whether this type represents an anonymous type.booleanisClass()Returns whether this type represents a class.booleanisEnum()Returns whether this type represents an enumeration class.booleanReturns whether this type is implicitly declared.booleanReturns whether this type represents an interface.booleanisLambda()Returns whether this type represents a lambda expression.booleanisLocal()Returns whether this type represents a local type.booleanisMember()Returns whether this type represents a member type.booleanisRecord()Returns whether this type represents a record class.booleanReturns whether this type represents a resolved type.booleanisSealed()Returns whether this type is a sealed type.loadTypeHierachy(InputStream input, WorkingCopyOwner owner, org.eclipse.core.runtime.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.loadTypeHierachy(InputStream input, org.eclipse.core.runtime.IProgressMonitor monitor) Loads a previously saved ITypeHierarchy from an input stream.newSupertypeHierarchy(ICompilationUnit[] workingCopies, org.eclipse.core.runtime.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.newSupertypeHierarchy(IWorkingCopy[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) Deprecated.newSupertypeHierarchy(WorkingCopyOwner owner, org.eclipse.core.runtime.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.newSupertypeHierarchy(org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a type hierarchy for this type containing this type and all of its supertypes.newTypeHierarchy(ICompilationUnit[] workingCopies, org.eclipse.core.runtime.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.newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.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.newTypeHierarchy(IJavaProject project, org.eclipse.core.runtime.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.newTypeHierarchy(IWorkingCopy[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) Deprecated.newTypeHierarchy(WorkingCopyOwner owner, org.eclipse.core.runtime.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.newTypeHierarchy(org.eclipse.core.runtime.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.protected voidtoStringInfo(int tab, StringBuilder buffer, Object info, boolean showResolvedInfo) for debugging onlyMethods inherited from class NamedMember
getElementName, getFullyQualifiedName, getFullyQualifiedParameterizedName, getKey, getKey, getKey, getKey, getTypeQualifiedName, resolveType, resolveTypeModifier and TypeMethodDescriptionReturns the name of this element.getFullyQualifiedName(char enclosingTypeSeparator, boolean showParameters) protected StringgetFullyQualifiedParameterizedName(String fullyQualifiedName, String uniqueKey) protected Stringprotected Stringprotected StringgetKey(IModuleDescription module, boolean forceOpen) protected StringgetTypeQualifiedName(char enclosingTypeSeparator, boolean showParameters) String[][]resolveType(String typeName) String[][]resolveType(String typeName, WorkingCopyOwner owner) Methods inherited from class Member
areSimilarMethods, convertConstant, findMethods, getCategories, getFlags, getHandleMementoDelimiter, getJavadocRange, getNameRange, getOuterMostLocalContext, getType, getTypeRoot, isBinary, isMainMethod, isMainMethodCandidate, isReadOnly, readableNameModifier and TypeMethodDescriptionprotected static booleanareSimilarMethods(String name1, String[] params1, String name2, String[] params2, String[] simpleNames1) protected static ObjectconvertConstant(Constant constant) Converts a field constant from the compiler's representation to the Java Model constant representation (Number or String).static IMethod[]findMethods(IMethod method, IMethod[] methods) String[]Returns the categories defined by this member's Javadoc.intgetFlags()Returns the modifier flags for this member.protected charReturns thecharthat marks the start of this handles contribution to a memento.Returns the Javadoc range if this element is from source or if this element is a binary element with an attached source, null otherwise.Returns the name range associated with this element.Returns the local or anonymous type declared in this source member with the given simple name and/or with the specified position relative to the order they are defined in the source.Returns the Java type root in which this member is declared.booleanisBinary()Returns whether this member is from a class file.protected booleanisMainMethod(IMethod method) protected booleanisMainMethodCandidate(IMethod method) booleanReturns whether this Java element is read-only.Methods inherited from class SourceRefElement
calculateHashCode, copy, createElementInfo, delete, findNode, generateInfos, getAnnotation, getCompilationUnit, getCorrespondingResource, getHandleMemento, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getSourceRange, getUnderlyingResource, hasChildren, incOccurrenceCount, isStructureKnown, move, rename, resource, setOccurrenceCount, toStringNameModifier and TypeMethodDescriptionprotected intvoidcopy(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) protected JavaElementInfoReturns a new element info for this element.voiddelete(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) findNode(CompilationUnit ast) Returns theASTNodethat corresponds to thisJavaElementornullif there is no corresponding node.protected voidgenerateInfos(IElementInfo info, Map<IJavaElement, IElementInfo> newElements, org.eclipse.core.runtime.IProgressMonitor pm) Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable).getAnnotation(String name) org.eclipse.core.resources.IResourceElements within compilation units and class files have no corresponding resource.protected voidgetHandleUpdatingCountFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) intReturn the first instance of IOpenable in the hierarchy of this type (going up the hierarchy from this type);org.eclipse.core.runtime.IPathgetPath()Returns the path to the innermost resource enclosing this element.Returns the source code associated with this element.Returns the source range associated with this element.org.eclipse.core.resources.IResourceReturns the smallest underlying resource that contains this element, ornullif this element is not contained in a resource.booleanvoidbooleanReturns whether the structure of this element is known.voidmove(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) voidorg.eclipse.core.resources.IResourceresource()voidsetOccurrenceCount(int occurrenceCount) protected voidtoStringName(StringBuilder buffer) Debugging purposesMethods inherited from class JavaElement
appendEscapedDelimiter, 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, resetHashCode, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheModifier and TypeMethodDescriptionprotected voidappendEscapedDelimiter(StringBuilder buffer, char delimiter) voidclose()protected voidescapeMementoName(StringBuilder buffer, String mementoName) booleanexists()Returns whether this Java element exists in the model.getAncestor(int ancestorType) Returns this Java element or the first ancestor of this element that has the given type.getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the Javadoc as HTML source if this element has attached Javadoc,nullotherwise.getChildrenOfType(int type) Returns a collection of (immediate) children of this node of the specified type.Returns the info for this handle.getElementInfo(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the info for this handle.getHandleFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) Returns a string representation of this element handle.protected URLReturns the Java model.Returns the Java project this element is contained in, ornullif this element is not contained in any Java project (for instance, theIJavaModelis not contained in any Java project).protected static URLReturns the first openable parent.Returns the element directly containing this element, ornullif this element has no parent.Returns the primary element (whose compilation unit is the primary compilation unit) this working copy element was created from, or this element if it is a descendant of a primary compilation unit or if it is not a descendant of a working copy (e.g.org.eclipse.core.resources.IResourceReturns the innermost resource enclosing this element.org.eclipse.core.runtime.jobs.ISchedulingRuleReturns the scheduling rule associated with this Java element.protected IJavaElementgetSourceElementAt(int position) Returns the element that is located at the given source position in this element.Returns the SourceMapper facility for this element, ornullif this element does not have a SourceMapper.protected StringgetURLContents(URL baseLoc, String docUrlValue) final inthashCode()Returns the hash code for this Java element.booleanReturns true if this element is an ancestor of the given element, otherwise false.protected JavaModelStatusnewJavaModelException(org.eclipse.core.runtime.IStatus status) Creates and returns a new Java model exception for this element with the given status.Creates and returns a new not present exception for this element.protected IElementInfoopenWhenClosed(IElementInfo info, boolean forceAdd, org.eclipse.core.runtime.IProgressMonitor monitor) protected voidshould not be needed but some implementations do have mutable member "occurrenceCount"protected StringtabString(int tab) Debugging purposestoString()Debugging purposesprotected voidtoString(int tab, StringBuilder buffer) Debugging purposesprotected voidtoStringAncestors(StringBuilder buffer) Debugging purposesprotected voidtoStringChildren(int tab, StringBuilder buffer, Object info) Debugging purposestoStringInfo(int tab, StringBuilder buffer) Debugging purposesDebugging purposestoStringWithAncestors(boolean showResolvedInfo) Debugging purposesprotected voidvalidateAndCache(URL baseLoc, FileNotFoundException e) Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapterMethods inherited from interface IAnnotatable
getAnnotationModifier and TypeMethodDescriptiongetAnnotation(String name) Returns the annotation with the given name declared on this element.Methods inherited from interface IMember
getCompilationUnit, getOccurrenceCountModifier and TypeMethodDescriptionReturns the compilation unit in which this member is declared, ornullif this member is not declared in a compilation unit (for example, a binary type).intReturns the position relative to the order this member is defined in the source.Methods inherited from interface IParent
getChildren, hasChildrenModifier and TypeMethodDescriptionReturns the immediate children of this element.booleanReturns whether this element has one or more immediate children.Methods inherited from interface ISourceManipulation
copy, delete, move, renameModifier and TypeMethodDescriptionvoidcopy(IJavaElement container, IJavaElement sibling, String rename, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) Copies this element to the given container.voiddelete(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Deletes this element, forcing if specified and necessary.voidmove(IJavaElement container, IJavaElement sibling, String rename, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) Moves this element to the given container.voidRenames this element to the given name.Methods inherited from interface ISourceReference
existsModifier and TypeMethodDescriptionbooleanexists()Returns whether this element exists in the model.Methods inherited from interface IType
getElementName, resolveType, resolveTypeModifier and TypeMethodDescriptionReturns the simple name of this type, unqualified by package or enclosing type.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.
-
Field Details
-
localOccurrenceCount
public int localOccurrenceCount
-
-
Constructor Details
-
SourceType
-
SourceType
-
-
Method Details
-
closing
Description copied from class:SourceRefElementThis element is being closed. Do any necessary cleanup.- Overrides:
closingin classSourceRefElement- Throws:
JavaModelException
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor) throws JavaModelException Deprecated.Description copied from interface:ITypeDo code completion inside a code snippet in the context of the current type. 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.- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position within snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestor- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException Deprecated.Description copied from interface:ITypeDo 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 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.
- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position with in snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestorowner- the owner of working copies that take precedence over their original compilation units- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor) throws JavaModelException Description copied from interface:ITypeDo code completion inside a code snippet in the context of the current type. 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.- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position within snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestor- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeDo code completion inside a code snippet in the context of the current type. 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
IProgressMonitoris notnullthen some proposals which can be very long to compute are proposed. To avoid that the code assist operation take too much time aIProgressMonitorwhich 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(); } ... };- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position within snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestormonitor- the progress monitor used to report progress- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner) throws JavaModelException Description copied from interface:ITypeDo 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 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.
- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position with in snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestorowner- the owner of working copies that take precedence over their original compilation units- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
codeComplete
public void codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, CompletionRequestor requestor, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeDo 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 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
IProgressMonitoris notnullthen some proposals which can be very long to compute are proposed. To avoid that the code assist operation take too much time aIProgressMonitorwhich 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(); } ... };- Specified by:
codeCompletein interfaceIType- Parameters:
snippet- the code snippetinsertion- the position with in source where the snippet is inserted. This position must not be in comments. A possible value is -1, if the position is not known.position- the position with in snippet where the user is performing code assist.localVariableTypeNames- an array (possibly empty) of fully qualified type names of local variables visible at the current scopelocalVariableNames- an array (possibly empty) of local variable names that are visible at the current scopelocalVariableModifiers- an array (possible empty) of modifiers for local variablesisStatic- whether the current scope is in a static contextrequestor- the completion requestorowner- the owner of working copies that take precedence over their original compilation unitsmonitor- the progress monitor used to report progress- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
createField
public IField createField(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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
forceparameter affects the resolution of such a conflict:-
true- in this case the field is created with the new contents -
false- in this case aJavaModelExceptionis thrown
- Specified by:
createFieldin interfaceIType- Parameters:
contents- the given contentssibling- the given siblingforce- a flag in case the same name already exists in this typemonitor- the given progress monitor- Returns:
- a field in this type with the given contents
- Throws:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred 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)
- See Also:
-
-
createInitializer
public IInitializer createInitializer(String contents, IJavaElement sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
createInitializerin interfaceIType- Parameters:
contents- the given contentssibling- the given siblingmonitor- the given progress monitor- Returns:
- a static initializer in this type with the given contents
- Throws:
JavaModelException- if the element could not be created. Reasons include:- This element does not exist
- A
CoreExceptionoccurred 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)
- See Also:
-
createMethod
public IMethod createMethod(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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
forceparameter affects the resolution of such a conflict:-
true- in this case the method is created with the new contents -
false- in this case aJavaModelExceptionis thrown
- Specified by:
createMethodin interfaceIType- Parameters:
contents- the given contentssibling- the given siblingforce- a flag in case the same name already exists in this typemonitor- the given progress monitor- Returns:
- a method or constructor in this type with the given contents
- Throws:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred 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 constructor declaration (INVALID_CONTENTS)
- This type is read-only (binary) (READ_ONLY)
- There was a naming collision with an existing method (NAME_COLLISION)
- See Also:
-
-
createType
public IType createType(String contents, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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
forceparameter affects the resolution of such a conflict:-
true- in this case the type is created with the new contents -
false- in this case aJavaModelExceptionis thrown
- Specified by:
createTypein interfaceIType- Parameters:
contents- the given contentssibling- the given siblingforce- a flag in case the same name already exists in this typemonitor- the given progress monitor- Returns:
- a type in this type with the given contents
- Throws:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred 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)
- See Also:
-
-
equals
Description copied from class:JavaElementReturns true if this handle represents the same Java element as the given handle. By default, two handles represent the same element if they are identical or if they represent the same type of element, have equal names, parents, and occurrence counts.If a subclass has other requirements for equality, this method must be overridden.
- Overrides:
equalsin classSourceRefElement- See Also:
-
findMethods
Description copied from interface:ITypeFinds 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.
- Specified by:
findMethodsin interfaceIType- Parameters:
method- the given method- Returns:
- the found method or
nullif no such methods can be found.
-
getAnnotations
Description copied from interface:IAnnotatableReturns the annotations for this element. Returns an empty array if this element has no annotations.- Specified by:
getAnnotationsin interfaceIAnnotatable- Overrides:
getAnnotationsin classSourceRefElement- Returns:
- the annotations of this element, in the order declared in the source, or an empty array if none
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getChildrenForCategory
Description copied from interface:ITypeReturns the children of this type that have the given category as a@categorytag. 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.
- Specified by:
getChildrenForCategoryin interfaceIType- Returns:
- the children for the given category.
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getDeclaringType
Description copied from interface:IMemberReturns the type in which this member is declared, ornullif this member is not declared in a type (for example, a top-level type). This is a handle-only method.- Specified by:
getDeclaringTypein interfaceIMember- Overrides:
getDeclaringTypein classMember- Returns:
- the type in which this member is declared, or
nullif this member is not declared in a type (for example, a top-level type) - See Also:
-
getClassFile
Description copied from interface:IMemberReturns the class file in which this member is declared, ornullif this member is not declared in a class file (for example, a source type). This is a handle-only method.- Specified by:
getClassFilein interfaceIMember- Specified by:
getClassFilein interfaceIType- Overrides:
getClassFilein classMember- Returns:
- the class file in which this member is declared, or
nullif this member is not declared in a class file (for example, a source type) - See Also:
-
getElementType
public int getElementType()Description copied from interface:IJavaElementReturns this element's kind encoded as an integer. This is a handle-only method.- Specified by:
getElementTypein interfaceIJavaElement- Returns:
- the kind of element; one of the constants declared in
IJavaElement - See Also:
-
getField
Description copied from interface:ITypeReturns 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. -
getFields
Description copied from interface:ITypeReturns the fields declared by this type in the order in which they appear in the source or class file. For binary types, this includes synthetic fields. This does not include the implicit fields representing record components.- Specified by:
getFieldsin interfaceIType- Returns:
- the fields declared by this type
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
getRecordComponents
Description copied from interface:ITypeReturns the record components declared by this record class, or an empty array if this is not a record.- Specified by:
getRecordComponentsin interfaceIType- Returns:
- record components declared by this record class
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getPermittedSubtypeNames
Description copied from interface:ITypeReturns the names of types that this sealed type permits to be its subtypes. For a non sealed type, an empty array is returned. If type declares an explicit permits clause, then the permitted subtypes are returned in the declared order. If a sealed type does not explicitly declare permitted subtypes, then the implicit permitted types, that is, the types in the same compilation unit that are subtypes of this sealed type are returned in the order they appear within the compilation unit.- Specified by:
getPermittedSubtypeNamesin interfaceIType- Returns:
- names of types that this type permits to be its subtypes
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getRecordComponent
Description copied from interface:ITypeReturns the record component with the specified name in this type (for example,"bar"). This is a handle-only method. The record component may or may not exist.- Specified by:
getRecordComponentin interfaceIType- Parameters:
compName- the given name- Returns:
- the record component with the specified name in this record
-
getFullyQualifiedName
Description copied from interface:ITypeReturns 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.Note: The enclosing type separator used in the type-qualified name is
This method is fully equivalent to'$', not'.'.getFullyQualifiedName('$'). This is a handle-only method.- Specified by:
getFullyQualifiedNamein interfaceIType- Returns:
- the fully qualified name of this type
- See Also:
-
getFullyQualifiedName
Description copied from interface:ITypeReturns 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 theenclosingTypeSeparator. 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"
- Specified by:
getFullyQualifiedNamein interfaceIType- Parameters:
enclosingTypeSeparator- the given enclosing type separator- Returns:
- the fully qualified name of this type, including qualification for any containing types and packages
- See Also:
-
getFullyQualifiedParameterizedName
Description copied from interface:ITypeReturns 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. For example, "p.X<T>", "java.util.Map<java.lang.String, p.X>"- Specified by:
getFullyQualifiedParameterizedNamein interfaceIType- Returns:
- the fully qualified parameterized representation of this type
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getOccurrenceCountSignature
- Overrides:
getOccurrenceCountSignaturein classNamedMember
-
getHandleFromMemento
public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) - Overrides:
getHandleFromMementoin classMember
-
getInitializer
Description copied from interface:ITypeReturns 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.- Specified by:
getInitializerin interfaceIType- Parameters:
count- the specified position- Returns:
- the initializer with the specified position relative to the order they are defined in the source
- See Also:
-
getInitializers
Description copied from interface:ITypeReturns the initializers declared by this type. For binary types this is an empty collection. For source types, the results are listed in the order in which they appear in the source.- Specified by:
getInitializersin interfaceIType- Returns:
- the initializers declared by this type
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
getKey
Description copied from interface:ITypeReturns the binding key for this type only if the given type isresolved. 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.
-
getMethod
Description copied from interface:ITypeReturns 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
Signaturefor details. Note that the parameter type signatures for binary methods are expected to be dot-based. -
getMethods
Description copied from interface:ITypeReturns the methods and constructors declared by this type. For binary types, this may include the special<clinit>method and synthetic methods.The results are listed in the order in which they appear in the source or class file.
- Specified by:
getMethodsin interfaceIType- Returns:
- the methods and constructors declared by this type
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
getPackageFragment
Description copied from interface:ITypeReturns the package fragment in which this element is defined. This is a handle-only method.- Specified by:
getPackageFragmentin interfaceIType- Overrides:
getPackageFragmentin classNamedMember- Returns:
- the package fragment in which this element is defined
- See Also:
-
getPrimaryElement
- Overrides:
getPrimaryElementin classJavaElement
-
getSuperclassName
Description copied from interface:ITypeReturns the name of this type's superclass, ornullfor 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, useIType.getSuperclassTypeSignature()which returns a structured type signature string containing more precise information.- Specified by:
getSuperclassNamein interfaceIType- Returns:
- the name of this type's superclass, or
nullfor source types that do not specify a superclass - Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
getSuperclassTypeSignature
Description copied from interface:ITypeReturns the type signature of this type's superclass, ornullif 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
Signaturefor details.- Specified by:
getSuperclassTypeSignaturein interfaceIType- Returns:
- the type signature of this type's superclass, or
nullif none - Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.0
- See Also:
-
getSuperInterfaceNames
Description copied from interface:ITypeReturns 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.- Specified by:
getSuperInterfaceNamesin interfaceIType- Returns:
- 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
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
getSuperInterfaceTypeSignatures
Description copied from interface:ITypeReturns 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
Signaturefor details.- Specified by:
getSuperInterfaceTypeSignaturesin interfaceIType- Returns:
- the type signatures of interfaces that this type implements or extends, in the order in which they are listed in the source, an empty collection if none
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.0
- See Also:
-
getTypeParameters
Description copied from interface:ITypeReturns the formal type parameters for this type. Returns an empty array if this type has no formal type parameters.- Specified by:
getTypeParametersin interfaceIType- Overrides:
getTypeParametersin classNamedMember- Returns:
- the formal type parameters of this type, in the order declared in the source, an empty array if none
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
getTypeParameterSignatures
Description copied from interface:ITypeReturns 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
Signaturefor details.- Specified by:
getTypeParameterSignaturesin interfaceIType- Returns:
- the formal type parameter signatures of this type, in the order declared in the source, an empty array if none
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.0
- See Also:
-
getType
Description copied from interface:ITypeReturns 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. -
getTypeParameter
Description copied from interface:ITypeReturns 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.- Specified by:
getTypeParameterin interfaceIType- Parameters:
typeParameterName- the given simple name- Returns:
- the type parameter declared in this type with the given name
-
getTypeQualifiedName
Description copied from interface:ITypeReturns 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 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 togetTypeQualifiedName('$'). This is a handle-only method.- Specified by:
getTypeQualifiedNamein interfaceIType- Returns:
- the type-qualified name of this type
- See Also:
-
getTypeQualifiedName
Description copied from interface:ITypeReturns 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 byenclosingTypeSeparator, 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 theenclosingTypeSeparatorcharacter. 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"
- Specified by:
getTypeQualifiedNamein interfaceIType- Parameters:
enclosingTypeSeparator- the specified enclosing type separator- Returns:
- the type-qualified name of this type
- See Also:
-
getTypes
Description copied from interface:ITypeReturns 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.- Specified by:
getTypesin interfaceIType- Returns:
- the immediate member types declared by this type
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
isAnonymous
public boolean isAnonymous()Description copied from interface:ITypeReturns whether this type represents an anonymous type.- Specified by:
isAnonymousin interfaceIType- Returns:
- true if this type represents an anonymous type, false otherwise
- See Also:
-
isClass
Description copied from interface:ITypeReturns whether this type represents a class.Note that a class can neither be an interface, an enumeration class, nor an annotation type.
- Specified by:
isClassin interfaceIType- Returns:
- true if this type represents a class, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
isEnum
Description copied from interface:ITypeReturns whether this type represents an enumeration class.Note that an enumeration class can neither be a class, an interface, nor an annotation type.
- Specified by:
isEnumin interfaceIType- Returns:
- true if this type represents an enumeration class, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.0
- See Also:
-
isRecord
Description copied from interface:ITypeReturns whether this type represents a record class.Note that a record class can neither be an enumeration, an interface, nor an annotation type.
- Specified by:
isRecordin interfaceIType- Returns:
- true if this type represents a record class, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.26
- See Also:
-
isSealed
Description copied from interface:ITypeReturns whether this type is a sealed type.- Specified by:
isSealedin interfaceIType- Returns:
- true if this type this type is a sealed type, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
isInterface
Description copied from interface:ITypeReturns 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.
- Specified by:
isInterfacein interfaceIType- Returns:
- true if this type represents an interface, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
isAnnotation
Description copied from interface:ITypeReturns 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.
- Specified by:
isAnnotationin interfaceIType- Returns:
- true if this type represents an annotation type, false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- Since:
- 3.0
- See Also:
-
isLocal
public boolean isLocal()Description copied from interface:ITypeReturns whether this type represents a local type. For an anonymous type, this method returns true.Note: This deviates from JLS3 14.3, which states that anonymous types are not local types since they do not have a name.
-
isMember
-
isResolved
public boolean isResolved()Description copied from interface:ITypeReturns whether this type represents a resolved type. If a type is resolved, its key contains resolved information.- Specified by:
isResolvedin interfaceIType- Returns:
- whether this type represents a resolved type.
-
loadTypeHierachy
public ITypeHierarchy loadTypeHierachy(InputStream input, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeLoads 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)
- Specified by:
loadTypeHierachyin interfaceIType- Parameters:
input- stream where hierarchy will be readmonitor- the given progress monitor- Returns:
- the stored hierarchy
- Throws:
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:
-
loadTypeHierachy
public ITypeHierarchy loadTypeHierachy(InputStream input, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException 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. This is especially har at startup time. In case clients want this API, here is how it should be specified: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:
- IType#newSupertypeHierarchy(IProgressMonitor)
- IType#newSupertypeHierarchy(WorkingCopyOwner, IProgressMonitor)
- IType#newTypeHierarchy(IJavaProject, IProgressMonitor)
- IType#newTypeHierarchy(IJavaProject, WorkingCopyOwner, IProgressMonitor)
- IType#newTypeHierarchy(IProgressMonitor)
- IType#newTypeHierarchy(WorkingCopyOwner, IProgressMonitor)
- Parameters:
input- stream where hierarchy will be readmonitor- the given progress monitor- Returns:
- the stored hierarchy
- Throws:
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, ...)- Since:
- 3.0
- See Also:
-
newSupertypeHierarchy
public ITypeHierarchy newSupertypeHierarchy(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates and returns a type hierarchy for this type containing this type and all of its supertypes.- Specified by:
newSupertypeHierarchyin interfaceIType- Parameters:
monitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type and all of its supertypes
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newSupertypeHierarchy
public ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
newSupertypeHierarchyin interfaceIType- Parameters:
workingCopies- the working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type and all of its supertypes
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
newSupertypeHierarchy
public ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Deprecated.Description copied from interface:ITypeCreates 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.
- Specified by:
newSupertypeHierarchyin interfaceIType- Parameters:
workingCopies- the working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type and all of its supertypes
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newSupertypeHierarchy
public ITypeHierarchy newSupertypeHierarchy(WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
newSupertypeHierarchyin interfaceIType- Parameters:
owner- the owner of working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type and all of its supertypes
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(IJavaProject project, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
project- the given projectmonitor- the given progress monitor- 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
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
project- the given projectowner- the owner of working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- 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
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates and returns a type hierarchy for this type containing this type, all of its supertypes, and all its subtypes in the workspace.- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
monitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type, all of its supertypes, and all its subtypes in the workspace
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
workingCopies- the working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type, all of its supertypes, and all its subtypes in the workspace
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Deprecated.Description copied from interface:ITypeCreates 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.
- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
workingCopies- the working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type, all of its supertypes, and all its subtypes in the workspace
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
newTypeHierarchy
public ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeCreates 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.
- Specified by:
newTypeHierarchyin interfaceIType- Parameters:
owner- the owner of working copies that take precedence over their original compilation unitsmonitor- the given progress monitor- Returns:
- a type hierarchy for this type containing this type, all of its supertypes, and all its subtypes in the workspace
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
-
resolved
- Overrides:
resolvedin classJavaElement
-
toStringInfo
for debugging only- Overrides:
toStringInfoin classJavaElement- Parameters:
showResolvedInfo- TODO
-
isLambda
-
isImplicitlyDeclared
Description copied from interface:ITypeReturns whether this type is implicitly declared.- Specified by:
isImplicitlyDeclaredin interfaceIType- Returns:
- true if this type is implicitly declared and false otherwise
- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource.
-