org.eclipse.jdt.internal.core
Class BinaryMember

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.jdt.internal.core.JavaElement
          extended by org.eclipse.jdt.internal.core.SourceRefElement
              extended by org.eclipse.jdt.internal.core.Member
                  extended by org.eclipse.jdt.internal.core.NamedMember
                      extended by org.eclipse.jdt.internal.core.BinaryMember
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IJavaElement, IMember, IParent, ISourceManipulation, ISourceReference
Direct Known Subclasses:
BinaryType, ResolvedBinaryField, ResolvedBinaryMethod

public abstract class BinaryMember
extends NamedMember

Common functionality for Binary member handles.


Field Summary
 
Fields inherited from class org.eclipse.jdt.internal.core.SourceRefElement
occurrenceCount
 
Fields inherited from class org.eclipse.jdt.internal.core.JavaElement
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_TYPE, JEM_TYPE_PARAMETER
 
Fields inherited from interface org.eclipse.jdt.core.IJavaElement
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
 
Method Summary
 void copy(IJavaElement container, IJavaElement sibling, java.lang.String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor)
          Copies this element to the given container.
 java.lang.String[] getCategories()
          Returns the categories defined by this member's Javadoc.
 java.lang.String getKey()
           
abstract  java.lang.String getKey(boolean forceOpen)
           
 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).
 ISourceRange getSourceRange()
          Returns the source range associated with this element.
 boolean isBinary()
          Returns whether this member is from a class file.
 boolean isStructureKnown()
          Returns whether the structure of this element is known.
 void move(IJavaElement container, IJavaElement sibling, java.lang.String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor)
          Moves this element to the given container.
 void rename(java.lang.String newName, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor)
          Renames this element to the given name.
 void setContents(java.lang.String contents, org.eclipse.core.runtime.IProgressMonitor monitor)
           
 
Methods inherited from class org.eclipse.jdt.internal.core.NamedMember
getElementName, getFullyQualifiedName, getTypeQualifiedName, resolveType, resolveType
 
Methods inherited from class org.eclipse.jdt.internal.core.Member
findMethods, getClassFile, getDeclaringType, getFlags, getHandleFromMemento, getJavadocRange, getOuterMostLocalContext, getType, getTypeRoot, isReadOnly, readableName
 
Methods inherited from class org.eclipse.jdt.internal.core.SourceRefElement
delete, equals, findNode, getAnnotation, getAnnotations, getCompilationUnit, getCorrespondingResource, getHandleUpdatingCountFromMemento, getOccurrenceCount, getOpenableParent, getPath, getSource, getUnderlyingResource, hasChildren, resource
 
Methods inherited from class org.eclipse.jdt.internal.core.JavaElement
close, exists, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getPrimaryElement, getResource, getSchedulingRule, getSourceMapper, hashCode, isAncestorOf, newJavaModelException, newNotPresentException, resolved, toDebugString, toString, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jdt.core.IMember
getCompilationUnit, getOccurrenceCount
 
Methods inherited from interface org.eclipse.jdt.core.IJavaElement
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jdt.core.ISourceReference
exists, getSource
 
Methods inherited from interface org.eclipse.jdt.core.ISourceManipulation
delete
 
Methods inherited from interface org.eclipse.jdt.core.IParent
getChildren, hasChildren
 

Method Detail

copy

public void copy(IJavaElement container,
                 IJavaElement sibling,
                 java.lang.String rename,
                 boolean force,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws JavaModelException
Description copied from interface: ISourceManipulation
Copies this element to the given container.

Specified by:
copy in interface ISourceManipulation
Overrides:
copy in class SourceRefElement
Parameters:
container - the container
sibling - the sibling element before which the copy should be inserted, or null if the copy should be inserted as the last child of the container
rename - the new name for the element, or null if the copy retains the name of this element
force - true if any existing child in the container with the target name should be replaced, and false to throw an exception in the event of a name collision
monitor - a progress monitor
Throws:
JavaModelException - if this element could not be copied. Reasons include:
  • This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
  • A CoreException occurred while updating an underlying resource
  • The container is of an incompatible type (INVALID_DESTINATION)
  • The sibling is not a child of the given container (INVALID_SIBLING)
  • The new name is invalid (INVALID_NAME)
  • A child in the container already exists with the same name (NAME_COLLISION) and replace has been specified as false
  • The container or this element is read-only (READ_ONLY)
See Also:
ISourceManipulation

getCategories

public java.lang.String[] getCategories()
                                 throws JavaModelException
Description copied from interface: IMember
Returns the categories defined by this member's Javadoc. A category is the identifier following the tag @category in the member's Javadoc. Returns an empty array if no category is defined in this member's Javadoc.

Specified by:
getCategories in interface IMember
Overrides:
getCategories in class Member
Returns:
the categories defined by this member's doc
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.

getKey

public java.lang.String getKey()

getKey

public abstract java.lang.String getKey(boolean forceOpen)
                                 throws JavaModelException
Throws:
JavaModelException
See Also:
Binding.computeUniqueKey()

getNameRange

public ISourceRange getNameRange()
                          throws JavaModelException
Description copied from interface: IMember
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).

Specified by:
getNameRange in interface IMember
Overrides:
getNameRange in class Member
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:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
See Also:
IMember

getSourceRange

public ISourceRange getSourceRange()
                            throws JavaModelException
Description copied from interface: ISourceReference
Returns the source range associated with this element.

For class files, this returns the range of the entire compilation unit associated with the class file (if there is one).

If this element has no associated source code null is either returned, or a source range with a -1 offset and a 0 length.

Specified by:
getSourceRange in interface ISourceReference
Overrides:
getSourceRange in class SourceRefElement
Returns:
the source range, or either null or [-1, 0] if this element has no associated source code
Throws:
JavaModelException - if an exception occurs while accessing its corresponding resource
See Also:
ISourceReference

isBinary

public boolean isBinary()
Description copied from interface: IMember
Returns whether this member is from a class file. This is a handle-only method.

Specified by:
isBinary in interface IMember
Overrides:
isBinary in class Member
Returns:
true if from a class file, and false if from a compilation unit
See Also:
IMember

isStructureKnown

public boolean isStructureKnown()
                         throws JavaModelException
Description copied from interface: IJavaElement
Returns whether the structure of this element is known. For example, for a compilation unit that has syntax errors, false is returned. If the structure of an element is unknown, navigations will return reasonable defaults. For example, getChildren for a compilation unit with syntax errors will return a collection of the children that could be parsed.

Note: This does not imply anything about consistency with the underlying resource/buffer contents.

Specified by:
isStructureKnown in interface IJavaElement
Overrides:
isStructureKnown in class SourceRefElement
Returns:
true if the structure of this element is known
Throws:
JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
See Also:
IJavaElement

move

public void move(IJavaElement container,
                 IJavaElement sibling,
                 java.lang.String rename,
                 boolean force,
                 org.eclipse.core.runtime.IProgressMonitor monitor)
          throws JavaModelException
Description copied from interface: ISourceManipulation
Moves this element to the given container.

Specified by:
move in interface ISourceManipulation
Overrides:
move in class SourceRefElement
Parameters:
container - the container
sibling - the sibling element before which the element should be inserted, or null if the element should be inserted as the last child of the container
rename - the new name for the element, or null if the element retains its name
force - true if any existing child in the container with the target name should be replaced, and false to throw an exception in the event of a name collision
monitor - a progress monitor
Throws:
JavaModelException - if this element could not be moved. Reasons include:
  • This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
  • A CoreException occurred while updating an underlying resource
  • The container is of an incompatible type (INVALID_DESTINATION)
  • The sibling is not a child of the given container (INVALID_SIBLING)
  • The new name is invalid (INVALID_NAME)
  • A child in the container already exists with the same name (NAME_COLLISION) and replace has been specified as false
  • The container or this element is read-only (READ_ONLY)
See Also:
ISourceManipulation

rename

public void rename(java.lang.String newName,
                   boolean force,
                   org.eclipse.core.runtime.IProgressMonitor monitor)
            throws JavaModelException
Description copied from interface: ISourceManipulation
Renames this element to the given name.

Specified by:
rename in interface ISourceManipulation
Overrides:
rename in class SourceRefElement
Parameters:
newName - the new name for the element
force - true if any existing element with the target name should be replaced, and false to throw an exception in the event of a name collision
monitor - a progress monitor
Throws:
JavaModelException - if this element could not be renamed. Reasons include:
  • This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
  • A CoreException occurred while updating an underlying resource
  • The new name is invalid (INVALID_NAME)
  • A child in the container already exists with the same name (NAME_COLLISION) and replace has been specified as false
  • This element is read-only (READ_ONLY)
See Also:
ISourceManipulation

setContents

public void setContents(java.lang.String contents,
                        org.eclipse.core.runtime.IProgressMonitor monitor)
                 throws JavaModelException
Throws:
JavaModelException