public class

Package

extends Object
java.lang.Object
   ↳ sun.tools.java.Package

Class Overview

This class is used to represent the classes in a package. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.

Summary

Public Constructors
Package(ClassPath path, Identifier pkg)
Create a package given a class path, and package name.
Package(ClassPath sourcePath, ClassPath binaryPath, Identifier pkg)
Create a package given a source path, binary path, and package name.
Public Methods
boolean classExists(Identifier className)
Check if a class is defined in this package.
boolean exists()
Check if the package exists
ClassFile getBinaryFile(Identifier className)
Get the .class file of a class
Enumeration getBinaryFiles()
ClassFile getSourceFile(String fileName)
ClassFile getSourceFile(Identifier className)
Get the .java file of a class
Enumeration getSourceFiles()
String toString()
Returns a string representation of the object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Package (ClassPath path, Identifier pkg)

Create a package given a class path, and package name.

Throws
IOException

public Package (ClassPath sourcePath, ClassPath binaryPath, Identifier pkg)

Create a package given a source path, binary path, and package name.

Throws
IOException

Public Methods

public boolean classExists (Identifier className)

Check if a class is defined in this package. (If it is an inner class name, it is assumed to exist only if its binary file exists. This is somewhat pessimistic.)

public boolean exists ()

Check if the package exists

public ClassFile getBinaryFile (Identifier className)

Get the .class file of a class

public Enumeration getBinaryFiles ()

public ClassFile getSourceFile (String fileName)

public ClassFile getSourceFile (Identifier className)

Get the .java file of a class

public Enumeration getSourceFiles ()

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a string representation of the object.