1472
1473 /**
1474 * A builder for building {@link ModuleDescriptor} objects.
1475 *
1476 * <p> {@code ModuleDescriptor} defines the {@link #newModule newModule},
1477 * {@link #newOpenModule newOpenModule}, and {@link #newAutomaticModule
1478 * newAutomaticModule} methods to create builders for building
1479 * <em>normal</em>, open, and automatic modules. </p>
1480 *
1481 * <p> The set of packages in the module are accumulated by the {@code
1482 * Builder} as the {@link ModuleDescriptor.Builder#exports(String) exports},
1483 * {@link ModuleDescriptor.Builder#opens(String) opens},
1484 * {@link ModuleDescriptor.Builder#packages(Set) packages},
1485 * {@link ModuleDescriptor.Builder#provides(String,List) provides}, and
1486 * {@link ModuleDescriptor.Builder#mainClass(String) mainClass} methods are
1487 * invoked. </p>
1488 *
1489 * <p> The module names, package names, and class names that are parameters
1490 * specified to the builder methods are the module names, package names,
1491 * and qualified names of classes (in named packages) as defined in the
1492 * <cite>The Java™ Language Specification</cite>. </p>
1493 *
1494 * <p> Example usage: </p>
1495 * <pre>{@code ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")
1496 * .requires("java.base")
1497 * .exports("org.acme.stats.core.clustering")
1498 * .exports("org.acme.stats.core.regression")
1499 * .packages(Set.of("org.acme.stats.core.internal"))
1500 * .build();
1501 * }</pre>
1502 *
1503 * @apiNote A {@code Builder} checks the components and invariants as
1504 * components are added to the builder. The rationale for this is to detect
1505 * errors as early as possible and not defer all validation to the
1506 * {@link #build build} method.
1507 *
1508 * @since 9
1509 * @spec JPMS
1510 */
1511 public static final class Builder {
1512 final String name;
|
1472
1473 /**
1474 * A builder for building {@link ModuleDescriptor} objects.
1475 *
1476 * <p> {@code ModuleDescriptor} defines the {@link #newModule newModule},
1477 * {@link #newOpenModule newOpenModule}, and {@link #newAutomaticModule
1478 * newAutomaticModule} methods to create builders for building
1479 * <em>normal</em>, open, and automatic modules. </p>
1480 *
1481 * <p> The set of packages in the module are accumulated by the {@code
1482 * Builder} as the {@link ModuleDescriptor.Builder#exports(String) exports},
1483 * {@link ModuleDescriptor.Builder#opens(String) opens},
1484 * {@link ModuleDescriptor.Builder#packages(Set) packages},
1485 * {@link ModuleDescriptor.Builder#provides(String,List) provides}, and
1486 * {@link ModuleDescriptor.Builder#mainClass(String) mainClass} methods are
1487 * invoked. </p>
1488 *
1489 * <p> The module names, package names, and class names that are parameters
1490 * specified to the builder methods are the module names, package names,
1491 * and qualified names of classes (in named packages) as defined in the
1492 * <cite>The Java Language Specification</cite>. </p>
1493 *
1494 * <p> Example usage: </p>
1495 * <pre>{@code ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")
1496 * .requires("java.base")
1497 * .exports("org.acme.stats.core.clustering")
1498 * .exports("org.acme.stats.core.regression")
1499 * .packages(Set.of("org.acme.stats.core.internal"))
1500 * .build();
1501 * }</pre>
1502 *
1503 * @apiNote A {@code Builder} checks the components and invariants as
1504 * components are added to the builder. The rationale for this is to detect
1505 * errors as early as possible and not defer all validation to the
1506 * {@link #build build} method.
1507 *
1508 * @since 9
1509 * @spec JPMS
1510 */
1511 public static final class Builder {
1512 final String name;
|