ModuleDescriptor.Builder (Java SE 9 & JDK 9 ) (original) (raw)


public static final class ModuleDescriptor.Builder
extends Object
A builder for building ModuleDescriptor objects.
ModuleDescriptor defines the newModule,newOpenModule, and newAutomaticModule methods to create builders for building_normal_, open, and automatic modules.
The set of packages in the module are accumulated by the Builder as the exports,opens,packages,provides, andmainClass methods are invoked.
The module names, package names, and class names that are parameters specified to the builder methods are the module names, package names, and qualified names of classes (in named packages) as defined in theThe Java™ Language Specification.
Example usage:

   ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")  
         .requires("java.base")  
         .exports("org.acme.stats.core.clustering")  
         .exports("org.acme.stats.core.regression")  
         .packages(Set.of("org.acme.stats.core.internal"))  
         .build();  
   

API Note:
A Builder checks the components and invariants as components are added to the builder. The rationale for this is to detect errors as early as possible and not defer all validation to thebuild method.
Since:
9

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.