Klasse JarPackageFragmentRoot

Alle implementierten Schnittstellen:
IBufferChangedListener, IJavaElement, IOpenable, IPackageFragmentRoot, IParent, org.eclipse.core.runtime.IAdaptable
Bekannte direkte Unterklassen:
JModPackageFragmentRoot, JrtPackageFragmentRoot

public class JarPackageFragmentRoot extends PackageFragmentRoot
A package fragment root that corresponds to a .jar or .zip.

NOTE: The only visible entries from a .jar or .zip package fragment root are .class files.

NOTE: A jar package fragment root may or may not have an associated resource.

Siehe auch:
  • Felddetails

    • EMPTY_LIST

      protected static final ArrayList EMPTY_LIST
    • jarPath

      protected final org.eclipse.core.runtime.IPath jarPath
      The path to the jar file (a workspace relative path if the jar is internal, or an OS path if the jar is external)
    • extraAttributes

      protected final IClasspathAttribute[] extraAttributes
      Reflects the extra attributes of the classpath entry declaring this root. Caution, this field is used in hashCode() Ungültige Eingabe: "&" equals() to avoid overzealous sharing. Can be null, if lookup via the corresponding classpath entry failed.
  • Konstruktordetails

    • JarPackageFragmentRoot

      public JarPackageFragmentRoot(org.eclipse.core.resources.IResource resource, org.eclipse.core.runtime.IPath externalJarPath, JavaProject project, IClasspathAttribute[] attributes)
      Constructs a package fragment root which is the root of the Java package directory hierarchy based on a JAR file.
  • Methodendetails

    • computeChildren

      protected boolean computeChildren(OpenableElementInfo info, org.eclipse.core.resources.IResource underlyingResource) throws JavaModelException
      Compute the package fragment children of this package fragment root. These are all of the directory zip entries, and any directories implied by the path of class files contained in the jar of this package fragment root.
      Setzt außer Kraft:
      computeChildren in Klasse PackageFragmentRoot
      Löst aus:
      JavaModelException - The resource associated with this package fragment root does not exist
    • createChildren

      protected IJavaElement[] createChildren(HashtableOfArrayToObject rawPackageInfo)
    • createElementInfo

      protected Object createElementInfo()
      Returns a new element info for this element.
      Setzt außer Kraft:
      createElementInfo in Klasse PackageFragmentRoot
    • determineKind

      protected int determineKind(org.eclipse.core.resources.IResource underlyingResource)
      A Jar is always K_BINARY.
      Setzt außer Kraft:
      determineKind in Klasse PackageFragmentRoot
    • equals

      public boolean equals(Object o)
      Returns true if this handle represents the same jar as the given handle. Two jars are equal if they share the same zip file.
      Setzt außer Kraft:
      equals in Klasse PackageFragmentRoot
      Siehe auch:
    • getElementName

      public String getElementName()
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns the name of this element. This is a handle-only method.
      Angegeben von:
      getElementName in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getElementName in Klasse PackageFragmentRoot
      Gibt zurück:
      the element name
      Siehe auch:
      • IAdaptable
    • getJar

      public ZipFile getJar() throws org.eclipse.core.runtime.CoreException
      Returns the underlying ZipFile for this Jar package fragment root.
      Löst aus:
      org.eclipse.core.runtime.CoreException - if an error occurs accessing the jar
    • getKind

      public int getKind()
      Beschreibung aus Schnittstelle kopiert: IPackageFragmentRoot
      Returns this package fragment root's kind encoded as an integer. A package fragment root can contain source files (i.e. files with one of the Java-like extensions, or .class files, but not both. If the underlying folder or archive contains other kinds of files, they are ignored. In particular, .class files are ignored under a source package fragment root, and source files are ignored under a binary package fragment root.
      Angegeben von:
      getKind in Schnittstelle IPackageFragmentRoot
      Setzt außer Kraft:
      getKind in Klasse PackageFragmentRoot
      Gibt zurück:
      this package fragment root's kind encoded as an integer
      Siehe auch:
    • getNonJavaResources

      public Object[] getNonJavaResources() throws JavaModelException
      Returns an array of non-java resources contained in the receiver.
      Angegeben von:
      getNonJavaResources in Schnittstelle IPackageFragmentRoot
      Setzt außer Kraft:
      getNonJavaResources in Klasse PackageFragmentRoot
      Gibt zurück:
      an array of non-Java resources (IFiles, IFolders, or IStorages if the package fragment root is in archive) contained in this package fragment root
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
      Siehe auch:
    • getPackageFragment

      public PackageFragment getPackageFragment(String[] pkgName)
      Setzt außer Kraft:
      getPackageFragment in Klasse PackageFragmentRoot
    • getPackageFragment

      public PackageFragment getPackageFragment(String[] pkgName, String mod)
      Setzt außer Kraft:
      getPackageFragment in Klasse PackageFragmentRoot
    • getClassFilePath

      public String getClassFilePath(String classname)
      Beschreibung aus Klasse kopiert: PackageFragmentRoot
      Returns the relative path within an archive for the given class file name. In certain kind of archives, such as a JMOD file, class files are stored in a nested folder, as opposed to directly under the root. It is the responsibility of such package fragment roots to provide the custom behavior.
      Setzt außer Kraft:
      getClassFilePath in Klasse PackageFragmentRoot
      Gibt zurück:
      the relative path for the class file within the archive
    • getModuleDescription

      public IModuleDescription getModuleDescription()
      Beschreibung aus Schnittstelle kopiert: IPackageFragmentRoot
      Returns the IModuleDescription that this package fragment root contains. Returns null if the root doesn't contain any named module or if the project compiler compliance is 1.8 or lower. If present the module descriptor is found as a child of the package fragment representing the default package. Note that only one of the source package fragment roots in a Java Project can legally contain a module descriptor.
      Angegeben von:
      getModuleDescription in Schnittstelle IPackageFragmentRoot
      Setzt außer Kraft:
      getModuleDescription in Klasse PackageFragmentRoot
      Gibt zurück:
      the IModuleDescription this root contains.
    • internalPath

      public org.eclipse.core.runtime.IPath internalPath()
      Setzt außer Kraft:
      internalPath in Klasse PackageFragmentRoot
    • resource

      public org.eclipse.core.resources.IResource resource(PackageFragmentRoot root)
      Setzt außer Kraft:
      resource in Klasse PackageFragmentRoot
    • getUnderlyingResource

      public org.eclipse.core.resources.IResource getUnderlyingResource() throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: IJavaElement
      Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.
      Angegeben von:
      getUnderlyingResource in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getUnderlyingResource in Klasse PackageFragmentRoot
      Gibt zurück:
      the underlying resource, or null if none
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its underlying resource
      Siehe auch:
    • hashCode

      public int hashCode()
      Beschreibung aus Klasse kopiert: JavaElement
      Returns the hash code for this Java element. By default, the hash code for an element is a combination of its name and parent's hash code. Elements with other requirements must override this method.
      Setzt außer Kraft:
      hashCode in Klasse PackageFragmentRoot
    • initRawPackageInfo

      protected void initRawPackageInfo(HashtableOfArrayToObject rawPackageInfo, String entryName, boolean isDirectory, String compliance)
    • isArchive

      public boolean isArchive()
      Beschreibung aus Schnittstelle kopiert: IPackageFragmentRoot
      Returns whether this package fragment root's underlying resource is a binary archive (a JAR or zip file).

      This is a handle-only method.

      Angegeben von:
      isArchive in Schnittstelle IPackageFragmentRoot
      Setzt außer Kraft:
      isArchive in Klasse PackageFragmentRoot
      Gibt zurück:
      true if this package fragment root's underlying resource is a binary archive, false otherwise
      Siehe auch:
    • isExternal

      public boolean isExternal()
      Beschreibung aus Schnittstelle kopiert: IPackageFragmentRoot
      Returns whether this package fragment root is external to the workbench (that is, a local file), and has no underlying resource.

      This is a handle-only method.

      Angegeben von:
      isExternal in Schnittstelle IPackageFragmentRoot
      Setzt außer Kraft:
      isExternal in Klasse PackageFragmentRoot
      Gibt zurück:
      true if this package fragment root is external to the workbench (that is, a local file), and has no underlying resource, false otherwise
      Siehe auch:
    • isReadOnly

      public boolean isReadOnly()
      Jars and jar entries are all read only
      Angegeben von:
      isReadOnly in Schnittstelle IJavaElement
      Setzt außer Kraft:
      isReadOnly in Klasse JavaElement
      Gibt zurück:
      true if this element is read-only
      Siehe auch:
    • resourceExists

      protected boolean resourceExists(org.eclipse.core.resources.IResource underlyingResource)
      Returns whether the corresponding resource or associated file exists
      Setzt außer Kraft:
      resourceExists in Klasse Openable
    • toStringAncestors

      protected void toStringAncestors(StringBuffer buffer)
      Beschreibung aus Klasse kopiert: JavaElement
      Debugging purposes
      Setzt außer Kraft:
      toStringAncestors in Klasse JavaElement
    • getIndexPath

      public URL getIndexPath()
    • getManifest

      public Manifest getManifest()
      Beschreibung aus Klasse kopiert: PackageFragmentRoot
      Convenience lookup, though currently only JarPackageFragmentRoot is searched for a manifest.
      Setzt außer Kraft:
      getManifest in Klasse PackageFragmentRoot