Class BinaryMember

All Implemented Interfaces:
IJavaElement, IMember, IParent, ISourceManipulation, ISourceReference, org.eclipse.core.runtime.IAdaptable
Direct Known Subclasses:
BinaryMethod, BinaryModule, BinaryType, ResolvedBinaryField

public abstract class BinaryMember extends NamedMember
Common functionality for Binary member handles.
  • Constructor Details

  • Method Details

    • copy

      public void copy(IJavaElement container, IJavaElement sibling, 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
    • getAnnotations

      protected IAnnotation[] getAnnotations(IBinaryAnnotation[] binaryAnnotations, long tagBits)
    • getStandardAnnotations

      protected IAnnotation[] getStandardAnnotations(long tagBits)
    • getCategories

      public 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 String getKey()
    • getKey

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

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

      If the element is an IMember, it 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).

      If this element is an IImportDeclaration, the source range of this import declaration's name, or null if this import declaration does not have associated source code (for example, a binary type).
      The source range for the name includes the trailing '*' if the call to IImportDeclaration.isOnDemand() returns true.

      If this element is an IPackageDeclaration, the source range of this package declaration's name, or null if this package declaration does not have associated source code (for example, a binary type).

      If this element is an IAnnotation, the source range of this annotation's name, or null if this annotation does not have associated source code (for example, in a binary type).

      If this element is an ITypeParameter, the source range of this type parameter's name, or null if this type parameter does not have associated source code (for example, in a binary type).

      If this element is an ITypeRoot or IImportContainer, it returns null.

      Specified by:
      getNameRange in interface ISourceReference
      Overrides:
      getNameRange in class Member
      Returns:
      the name range associated with this element, or null if not available
      Throws:
      JavaModelException
      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, either null is returned, or a source range with a -1 offset and a 0 length. SourceRange.isAvailable(ISourceRange) can be used to detect that case.

      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, 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(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(String contents, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
      Throws:
      JavaModelException