Java Reference
In-Depth Information
18.6. Package Objects and Specifications
Packages typically implement a specification, and they are also typically
from one organization. A Package object, unlike the other reflection types
(see Chapter 16 ), is not used to create or manipulate packages, but acts
only as a repository for information about the specification implemented
by a package (its title, vendor, and version number) and for informa-
tion about the implementation itself (its title, vendor, and version num-
ber). Although a package typically comes from a single organization, the
specification for that package (such as a statistical analysis library) may
have been defined by someone else. Programs using a package may need
to be able to determine the version of the specification implemented by
the package so that they use only functionality defined in that version.
Similarly, programs may need to know which version of the implement-
ation is provided, primarily to deal with bugs that may exist in different
versions. The main methods of Package allow access to this information:
public String getName()
Returns the name of this package.
public String getSpecificationTitle()
Returns the title of the specification this package implements,
or null if the title is unknown.
public String getSpecificationVersion()
Returns a string describing the version of the specification that
this package implements, or null if the version is unknown.
public String getSpecificationVendor()
Returns the name of the vendor that owns and maintains
the specification that this package implements, or null if the
vendor is unknown.
 
Search WWH ::




Custom Search