org.eclipse.wst.jsdt.core
Interface IMember

All Superinterfaces:
IJavaScriptElement, ILookupScope, IParent, ISourceManipulation, ISourceReference
All Known Subinterfaces:
IField, IFunction, IInitializer, IType

public interface IMember
extends IJavaScriptElement, ISourceReference, ISourceManipulation, IParent

Common protocol for JavaScript elements that can be members of javaScript files or types. This set consists of IType, IFunction, IField, and IInitializer.

This interface is not intended to be implemented by clients.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
 
Fields inherited from interface org.eclipse.wst.jsdt.core.IJavaScriptElement
CLASS_FILE, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVASCRIPT_MODEL, JAVASCRIPT_PROJECT, JAVASCRIPT_UNIT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
 
Method Summary
 java.lang.String[] getCategories()
          Returns the categories defined by this member's JSDoc.
 IClassFile getClassFile()
           
 IJavaScriptUnit getCompilationUnit()
          Deprecated. Use getJavaScriptUnit() instead
 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.
 IJavaScriptUnit getJavaScriptUnit()
          Returns the javaScript unit in which this member is declared, or null if this member is not declared in a javaScript unit.
 ISourceRange getJSdocRange()
          Returns the JSDoc range if this element is from source or if this element is a binary element with an attached source, null otherwise.
 ISourceRange getNameRange()
          Returns the source range of this member's simple name, or null if this member does not have a name (for example, an initializer), or if this member does not have associated source code (for example, a binary type).
 int getOccurrenceCount()
          Returns the position relative to the order this member is defined in the source.
 IType getType(java.lang.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 JavaScript type root in which this member is declared.
 boolean isBinary()
          Returns whether this member is from a non-editable file.
 
Methods inherited from interface org.eclipse.wst.jsdt.core.IJavaScriptElement
exists, getAncestor, getAttachedJavadoc, getCommonSuperType, getCorrespondingResource, getDisplayName, getElementName, getElementType, getHandleIdentifier, getHostPath, getJavaScriptModel, getJavaScriptProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown, isVirtual
 
Methods inherited from interface org.eclipse.wst.jsdt.core.ILookupScope
newNameLookup, newNameLookup, newSearchableNameEnvironment, newSearchableNameEnvironment
 
Methods inherited from interface org.eclipse.wst.jsdt.core.ISourceReference
exists, getSource, getSourceRange
 
Methods inherited from interface org.eclipse.wst.jsdt.core.ISourceManipulation
copy, delete, move, rename
 
Methods inherited from interface org.eclipse.wst.jsdt.core.IParent
getChildren, hasChildren
 

Method Detail

getCategories

java.lang.String[] getCategories()
                                 throws JavaScriptModelException
Returns the categories defined by this member's JSDoc. A category is the identifier following the tag @category in the member's JSDoc. Returns an empty array if no category is defined in this member's JSDoc.

Returns:
the categories defined by this member's doc
Throws:
JavaScriptModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.

getClassFile

IClassFile getClassFile()

getCompilationUnit

IJavaScriptUnit getCompilationUnit()
Deprecated. Use getJavaScriptUnit() instead

Returns the javaScript unit in which this member is declared, or null if this member is not declared in a javaScript unit . This is a handle-only method.

Returns:
the javaScript unit in which this member is declared, or null if this member is not declared in a javaScript unit

getJavaScriptUnit

IJavaScriptUnit getJavaScriptUnit()
Returns the javaScript unit in which this member is declared, or null if this member is not declared in a javaScript unit. This is a handle-only method.

Returns:
the javaScript unit in which this member is declared, or null if this member is not declared in a javaScript unit (for example, a binary type)

getDeclaringType

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). This is a handle-only method.

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)

getFlags

int getFlags()
             throws JavaScriptModelException
Returns the modifier flags for this member. The flags can be examined using class Flags.

Note that 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.

Returns:
the modifier flags for this member
Throws:
JavaScriptModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
See Also:
Flags

getJSdocRange

ISourceRange getJSdocRange()
                           throws JavaScriptModelException
Returns the JSDoc range if this element is from source or if this element is a binary element with an attached source, null otherwise.

If this element is from source, the jsdoc range is extracted from the corresponding source.

If this element is from a binary, the jsdoc is extracted from the attached source if present.

If this element's openable is not consistent, then null is returned.

Returns:
a source range corresponding to the jsdoc source or null if no source is available, this element has no jsdoc comment or this element's openable is not consistent
Throws:
JavaScriptModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
See Also:
IOpenable.isConsistent()

getNameRange

ISourceRange getNameRange()
                          throws JavaScriptModelException
Returns the source range of this member's simple name, or null if this member does not have a name (for example, an initializer), or if this member does not have associated source code (for example, a binary type).

Returns:
the source range of this member's simple name, or null if this member does not have a name (for example, an initializer), or if this member does not have associated source code (for example, a binary type)
Throws:
JavaScriptModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.

getOccurrenceCount

int getOccurrenceCount()
Returns the position relative to the order this member is defined in the source. Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).

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.

Returns:
the position relative to the order this member is defined in the source

getTypeRoot

ITypeRoot getTypeRoot()
Returns the JavaScript type root in which this member is declared. This is a handle-only method.

Returns:
the JavaScript type root in which this member is declared.

getType

IType getType(java.lang.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. The name is empty if it is an anonymous type. Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0). This is a handle-only method. The type may or may not exist. Throws a RuntimeException if this member is not a source member.

Parameters:
name - the given simple name
occurrenceCount - the specified position
Returns:
the type with the given name and/or with the specified position relative to the order they are defined in the source

isBinary

boolean isBinary()
Returns whether this member is from a non-editable file. This is a handle-only method.

Returns:
true if from a non-editable file, and false if from a javaScript unit