85 * has the following properties: 86 * <ul> 87 * <li>The name of the package is either {@code ""} (for classes in an unnamed package) 88 * or derived from the {@linkplain Class#getName() binary names} of the classes 89 * (for classes in a named package).</li> 90 * <li>The package is not sealed.</li> 91 * <li>The specification and implementation titles, versions, and vendors 92 * are unspecified.</li> 93 * <li>Any annotations on the package are read from {@code package-info.class} 94 * as specified above.</li> 95 * </ul> 96 * 97 * <p> 98 * A {@code Package} can be obtained with the {@link Package#getPackage 99 * Package.getPackage(String)} and {@link ClassLoader#getDefinedPackage 100 * ClassLoader.getDefinedPackage(String)} methods. 101 * Every {@code Package} defined by a class loader can be obtained 102 * with the {@link Package#getPackages Package.getPackages()} and 103 * {@link ClassLoader#getDefinedPackages} methods. 104 * 105 * @jvms 5.3 Run-time package 106 * @see <a href="../../../technotes/guides/jar/jar.html#versioning"> 107 * The JAR File Specification: Package Versioning</a> 108 * @see <a href="../../../technotes/guides/jar/jar.html#sealing"> 109 * The JAR File Specification: Package Sealing</a> 110 * @see ClassLoader#definePackage(String, String, String, String, String, String, String, URL) 111 * 112 * @since 1.2 113 * @revised 9 114 * @spec JPMS 115 */ 116 public class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement { 117 /** 118 * Return the name of this package. 119 * 120 * @return The fully-qualified name of this package as defined in section 6.5.3 of 121 * <cite>The Java™ Language Specification</cite>, 122 * for example, {@code java.lang} 123 */ 124 public String getName() { 125 return packageName(); 126 } 127 | 85 * has the following properties: 86 * <ul> 87 * <li>The name of the package is either {@code ""} (for classes in an unnamed package) 88 * or derived from the {@linkplain Class#getName() binary names} of the classes 89 * (for classes in a named package).</li> 90 * <li>The package is not sealed.</li> 91 * <li>The specification and implementation titles, versions, and vendors 92 * are unspecified.</li> 93 * <li>Any annotations on the package are read from {@code package-info.class} 94 * as specified above.</li> 95 * </ul> 96 * 97 * <p> 98 * A {@code Package} can be obtained with the {@link Package#getPackage 99 * Package.getPackage(String)} and {@link ClassLoader#getDefinedPackage 100 * ClassLoader.getDefinedPackage(String)} methods. 101 * Every {@code Package} defined by a class loader can be obtained 102 * with the {@link Package#getPackages Package.getPackages()} and 103 * {@link ClassLoader#getDefinedPackages} methods. 104 * 105 * @implNote 106 * The <a href="ClassLoader.html#builtinLoaders">builtin class loaders</a> 107 * do not explicitly define {@code Package} objects for packages in 108 * <em>named modules</em>. Instead those packages are automatically defined 109 * and have no specification and implementation versioning information. 110 * 111 * @jvms 5.3 Run-time package 112 * @see <a href="../../../technotes/guides/jar/jar.html#sealing"> 113 * The JAR File Specification: Package Sealing</a> 114 * @see ClassLoader#definePackage(String, String, String, String, String, String, String, URL) 115 * 116 * @since 1.2 117 * @revised 9 118 * @spec JPMS 119 */ 120 public class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement { 121 /** 122 * Return the name of this package. 123 * 124 * @return The fully-qualified name of this package as defined in section 6.5.3 of 125 * <cite>The Java™ Language Specification</cite>, 126 * for example, {@code java.lang} 127 */ 128 public String getName() { 129 return packageName(); 130 } 131 |