Methods Summary |
---|
public T | getAnnotation(java.lang.Class annotationType)Gets the annotation associated with the specified annotation type and
this package, if present.
Annotation[] list = getAnnotations();
for (int i = 0; i < list.length; i++) {
if (annotationType.isInstance(list[i])) {
return (T)list[i];
}
}
return null;
|
public java.lang.annotation.Annotation[] | getAnnotations()Gets all annotations associated with this package, if any.
return getDeclaredAnnotations(this, true);
|
public java.lang.annotation.Annotation[] | getDeclaredAnnotations()Gets all annotations directly declared on this package, if any.
return getDeclaredAnnotations(this, false);
|
private static native java.lang.annotation.Annotation[] | getDeclaredAnnotations(java.lang.Package pkg, boolean publicOnly)
|
public java.lang.String | getImplementationTitle()Returns the title of the implementation of this package, or {@code null}
if this is unknown. The format of this string is unspecified.
return implTitle;
|
public java.lang.String | getImplementationVendor()Returns the name of the vendor or organization that provides this
implementation of the package, or {@code null} if this is unknown. The
format of this string is unspecified.
return implVendor;
|
public java.lang.String | getImplementationVersion()Returns the version of the implementation of this package, or {@code
null} if this is unknown. The format of this string is unspecified.
return implVersion;
|
public java.lang.String | getName()Returns the name of this package in the standard dot notation; for
example: "java.lang".
return name;
|
public static java.lang.Package | getPackage(java.lang.String packageName)Attempts to locate the requested package in the caller's class loader. If
no package information can be located, {@code null} is returned.
ClassLoader classloader = VMStack.getCallingClassLoader();
return classloader.getPackage(packageName);
|
public static java.lang.Package[] | getPackages()Returns all the packages known to the caller's class loader.
ClassLoader classloader = VMStack.getCallingClassLoader();
return classloader.getPackages();
|
public java.lang.String | getSpecificationTitle()Returns the title of the specification this package implements, or
{@code null} if this is unknown.
return specTitle;
|
public java.lang.String | getSpecificationVendor()Returns the name of the vendor or organization that owns and maintains
the specification this package implements, or {@code null} if this is
unknown.
return specVendor;
|
public java.lang.String | getSpecificationVersion()Returns the version of the specification this package implements, or
{@code null} if this is unknown. The version string is a sequence of
non-negative integers separated by dots; for example: "1.2.3".
return specVersion;
|
public int | hashCode()
return name.hashCode();
|
public boolean | isAnnotationPresent(java.lang.Class annotationType)Indicates whether the specified annotation is present.
return getAnnotation(annotationType) != null;
|
public boolean | isCompatibleWith(java.lang.String version)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.
String[] requested = version.split(".");
String[] provided = specVersion.split(".");
for (int i = 0; i < Math.min(requested.length, provided.length); i++) {
int reqNum = Integer.parseInt(requested[i]);
int provNum = Integer.parseInt(provided[i]);
if (reqNum > provNum) {
return false;
} else if (reqNum < provNum) {
return true;
}
}
if (requested.length > provided.length) {
return false;
}
return true;
|
public boolean | isSealed()Indicates whether this package is sealed.
return sealBase != null;
|
public boolean | isSealed(java.net.URL url)Indicates whether this package is sealed with respect to the specified
URL.
return sealBase != null && sealBase.sameFile(url);
|
public java.lang.String | toString()
return "package " + name;
|