java.lang.Object | |
↳ | java.lang.Package |
Contains information about a Java package. This includes implementation and specification versions. Typically this information is retrieved from the manifest.
Packages are managed by class loaders. All classes loaded by the same loader
from the same package share a Package
instance.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the annotation associated with the specified annotation type and
this package, if present.
| |||||||||||
Gets all annotations associated with this package, if any.
| |||||||||||
Gets all annotations directly declared on this package, if any.
| |||||||||||
Returns the title of the implementation of this package, or
null
if this is unknown. | |||||||||||
Returns the name of the vendor or organization that provides this
implementation of the package, or
null if this is unknown. | |||||||||||
Returns the version of the implementation of this package, or
null if this is unknown. | |||||||||||
Returns the name of this package in the standard dot notation; for
example: "java.lang".
| |||||||||||
Attempts to locate the requested package in the caller's class loader.
| |||||||||||
Returns all the packages known to the caller's class loader.
| |||||||||||
Returns the title of the specification this package implements, or
null if this is unknown. | |||||||||||
Returns the name of the vendor or organization that owns and maintains
the specification this package implements, or
null if this is
unknown. | |||||||||||
Returns the version of the specification this package implements, or
null if this is unknown. | |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Indicates whether the specified annotation is present.
| |||||||||||
Indicates whether this package's specification version is compatible with
the specified version string.
| |||||||||||
Indicates whether this package is sealed with respect to the specified
URL.
| |||||||||||
Indicates whether this package is sealed.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.reflect.AnnotatedElement
|
Gets the annotation associated with the specified annotation type and this package, if present.
annotationType | the annotation type to look for. |
---|
Annotation
or null
.Gets all annotations associated with this package, if any.
Annotation
instances, which may be empty.Gets all annotations directly declared on this package, if any.
Annotation
instances, which may be empty.Returns the title of the implementation of this package, or null
if this is unknown. The format of this string is unspecified.
null
.
Returns the name of the vendor or organization that provides this
implementation of the package, or null
if this is unknown. The
format of this string is unspecified.
null
.
Returns the version of the implementation of this package, or null
if this is unknown. The format of this string is unspecified.
null
.
Returns the name of this package in the standard dot notation; for example: "java.lang".
Attempts to locate the requested package in the caller's class loader. If
no package information can be located, null
is returned.
packageName | the name of the package to find. |
---|
null
.Returns all the packages known to the caller's class loader.
Returns the title of the specification this package implements, or
null
if this is unknown.
null
.
Returns the name of the vendor or organization that owns and maintains
the specification this package implements, or null
if this is
unknown.
null
.
Returns the version of the specification this package implements, or
null
if this is unknown. The version string is a sequence of
non-negative integers separated by dots; for example: "1.2.3".
null
.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct hashCode
method
if you intend implementing your own hashCode
method.
Indicates whether the specified annotation is present.
annotationType | the annotation type to look for. |
---|
true
if the annotation is present; false
otherwise.Indicates whether this package's specification version is compatible with the specified version string. Version strings are compared by comparing each dot separated part of the version as an integer.
version | the version string to compare against. |
---|
true
if the package versions are compatible; false
otherwise.NumberFormatException | if this package's version string or the one provided are not in the correct format. |
---|
Indicates whether this package is sealed with respect to the specified URL.
url | the URL to check. |
---|
true
if this package is sealed with url
; false
otherwise
Indicates whether this package is sealed.
true
if this package is sealed; false
otherwise.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful toString
method
if you intend implementing your own toString
method.