Package class

Package objects contain version information about a Java package.

Get package for a name

ReturnMethodSummary
static PackagegetPackage(String name)Find a package by name in the callers ClassLoader instance.

Get all packages

ReturnMethodSummary
static Package[]getPackages()Get all the packages currently known for the caller's ClassLoader instance.

Get the annotations

ReturnMethodSummary
<A extends Annotation>A getAnnotation(Class<A> annotationClass) Returns this element's annotation for the specified type if such an annotation is present, else null.
Annotation[]getAnnotations()Returns all annotations present on this element.
Annotation[]getDeclaredAnnotations()Returns all annotations that are directly present on this element.

Get implementation title, vendor and version

ReturnMethodSummary
StringgetImplementationTitle()Return the title of this package.
StringgetImplementationVendor()Returns the name of the organization, vendor or company that provided this implementation.
StringgetImplementationVersion()Return the version of this implementation.

Get the package name

ReturnMethodSummary
StringgetName()Return the name of this package.

Get the specification title, vendor and version

ReturnMethodSummary
StringgetSpecificationTitle()Return the title of the specification.
StringgetSpecificationVendor()Return the name of the organization, vendor.
StringgetSpecificationVersion()Returns the version number.

Is Annotation present

ReturnMethodSummary
boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) Returns true if an annotation for the specified type is present on this element, else false.

Is this Package compatible with passed in package

ReturnMethodSummary
booleanisCompatibleWith(String desired)Compare this package's specification version with a desired version.

Is this Package sealed

ReturnMethodSummary
booleanisSealed()Returns true if this package is sealed.
booleanisSealed(URL url)Returns true if this package is sealed with respect to the specified code source url.

Get the string representation of the Package

ReturnMethodSummary
StringtoString()Returns the string representation of this Package.
Revised from Open JDK source code
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.