public interface IMember extends IJavaElement, ISourceReference, ISourceManipulation, IParent
IType
, IMethod
,
IField
, and IInitializer
.
The children are listed in the order in which they appear in the source or class file.
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
Modifier and Type | Method and Description |
---|---|
String[] |
getCategories()
Returns the categories defined by this member's Javadoc.
|
IClassFile |
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). |
ICompilationUnit |
getCompilationUnit()
Returns the compilation unit in which this member is declared, or
null
if this member is not declared in a compilation unit (for example, a binary type). |
IType |
getDeclaringType()
Returns the type in which this member is declared, or
null
if this member is not declared in a type (for example, a top-level type). |
int |
getFlags()
Returns the modifier flags for this member.
|
ISourceRange |
getJavadocRange()
Returns the Javadoc range if this element is from source or if this element
is a binary element with an attached source, null otherwise.
|
int |
getOccurrenceCount()
Returns the position relative to the order this member is defined in the source.
|
IType |
getType(String name,
int occurrenceCount)
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.
|
ITypeRoot |
getTypeRoot()
Returns the Java type root in which this member is declared.
|
boolean |
isBinary()
Returns whether this member is from a class file.
|
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementName, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown
getAdapter
exists, getNameRange, getSource, getSourceRange
copy, delete, move, rename
getChildren, hasChildren
String[] getCategories() throws JavaModelException
@category
in the member's Javadoc.
Returns an empty array if no category is defined in this member's Javadoc.JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IClassFile getClassFile()
null
if this member is not declared in a class file (for example, a source type).
This is a handle-only method.null
if this member is not declared in a class file (for example, a source type)ICompilationUnit getCompilationUnit()
null
if this member is not declared in a compilation unit (for example, a binary type).
This is a handle-only method.null
if this member is not declared in a compilation unit (for example, a binary type)IType getDeclaringType()
null
if this member is not declared in a type (for example, a top-level type).
This is a handle-only method.null
if this member is not declared in a type (for example, a top-level type)int getFlags() throws JavaModelException
Flags
.
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.
JavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.Flags
ISourceRange getJavadocRange() throws JavaModelException
If this element is from source, the javadoc range is extracted from the corresponding source.
If this element is from a binary, the javadoc is extracted from the attached source if present.
If this element's openable is not consistent, then null is returned.
null
if no source is available, this element has no javadoc comment or
this element's openable is not consistentJavaModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resource.IOpenable.isConsistent()
int getOccurrenceCount()
Two members m1 and m2 that are equal (e.g. 2 fields with the same name in the same type) can be distinguished using their occurrence counts. If member m1 appears first in the source, it will have an occurrence count of 1. If member m2 appears right after member m1, it will have an occurrence count of 2.
The occurrence count can be used to distinguish initializers inside a type or anonymous types inside a method.
This is a handle-only method. The member may or may not be present.
ITypeRoot getTypeRoot()
IType getType(String name, int occurrenceCount)
RuntimeException
if this member is not a source member.name
- the given simple nameoccurrenceCount
- the specified positionboolean isBinary()
true
if from a class file, and false
if
from a compilation unit
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.