public interface ModuleInfoDescriptor
Provides the basic formation for
module-info.java creation and manipulation.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumUsed to declare the preferred ordering of the items in the module-info. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddIfAbsent(io.helidon.pico.tools.DefaultModuleInfoDescriptor.Builder builder, String target, Supplier<ModuleInfoItem> itemSupplier) Takes a builder, and if the target does not yet exist, will add the new module info item from the supplier.default Stringcontents()Provides the content of the description appropriate to write out.default Stringcontents(boolean wantAnnotation) Provides the content of the description appropriate to write out.static ModuleInfoDescriptorcreate(InputStream is) Loads and creates themodule-infodescriptor given its source input stream.static ModuleInfoDescriptorcreate(InputStream is, ModuleInfoDescriptor.Ordering ordering) Loads and creates themodule-infodescriptor given its input stream.static ModuleInfoDescriptorLoads and creates themodule-infodescriptor given its literal source.static ModuleInfoDescriptorcreate(String moduleInfo, ModuleInfoDescriptor.Ordering ordering) Loads and creates themodule-infodescriptor given its literal source and preferred ordering scheme.static ModuleInfoDescriptorLoads and creates themodule-infodescriptor given its source file location.static ModuleInfoDescriptorcreate(Path path, ModuleInfoDescriptor.Ordering ordering) Loads and creates themodule-infodescriptor given its source file location and preferred ordering scheme.The description comment - will appear directly above the module'sname().static ModuleInfoItemexportsPackage(TypeName typeName) Creates a new itemexportson a package from this module descriptor.static ModuleInfoItemexportsPackage(String pkg) Creates a new itemexportson a package from this module descriptor.static ModuleInfoItemexportsPackage(String contract, String to) Creates a new itemexportson a package from this module descriptor, along with a'to'declaration.default Optional<ModuleInfoItem>Retrieves the first item matching the target requested.Returns the first export found in the module that is unqualified with any extratodeclaration.The header (i.e., copyright) comment - will appear at the very start of the output.default booleanReturns true if the name currently set is the same as theDEFAULT_MODULE_NAME.items()The items contained by this module-info.default ModuleInfoDescriptormergeCreate(ModuleInfoDescriptor another) Provides the ability to create a new merged descriptor using this as the basis, and then combining another into it in order to create a new descriptor.name()The module name.ordering()The ordering applied.static ModuleInfoItemprovidesContract(String contract, String with) Creates a new item declaring it to provide some contract from this module definition, along with a'with'declaration.static ModuleInfoItemrequiresModuleName(String moduleName) Creates a new item declaring arequireson an external module usage from this module descriptor.static ModuleInfoItemrequiresModuleName(String moduleName, boolean isTransitive, boolean isStatic, List<String> comments) Creates a new item declaring arequireson an external module usage from this module descriptor, that is extended to use additional item attributes.default voidSaves the descriptor source to the provided path.The template name to apply.static ModuleInfoItemusesExternalContract(TypeName externalContract) Creates a new item declaring ausesexternal contract definition from this module descriptor.static ModuleInfoItemusesExternalContract(Class<?> externalContract) Creates a new item declaring ausesexternal contract definition from this module descriptor.static ModuleInfoItemusesExternalContract(String externalContract) Creates a new item declaring ausesexternal contract definition from this module descriptor.
-
Field Details
-
DEFAULT_MODULE_NAME
The default module name (i.e., "unnamed").- See Also:
-
DEFAULT_TEST_SUFFIX
The default suffix on the module name for a test module. This suffix will be appended to the module name of the main module.- See Also:
-
MODULE_INFO_NAME
The base module-info name.- See Also:
-
DEFAULT_MODULE_INFO_JAVA_NAME
The java module-info name.- See Also:
-
-
Method Details
-
name
String name()The module name.- Returns:
- the module name
-
templateName
String templateName()The template name to apply. The default isTemplateHelper.DEFAULT_TEMPLATE_NAME.- Returns:
- the template name
-
headerComment
The header (i.e., copyright) comment - will appear at the very start of the output.- Returns:
- the header comment
-
descriptionComment
The description comment - will appear directly above the module'sname().- Returns:
- the description comment
-
ordering
ModuleInfoDescriptor.Ordering ordering()The ordering applied.- Returns:
- the ordering
-
items
List<ModuleInfoItem> items()The items contained by this module-info.- Returns:
- the items
-
isUnnamed
default boolean isUnnamed()Returns true if the name currently set is the same as theDEFAULT_MODULE_NAME.- Returns:
- true if the current name is the default name
-
mergeCreate
Provides the ability to create a new merged descriptor using this as the basis, and then combining another into it in order to create a new descriptor.- Parameters:
another- the other descriptor to merge- Returns:
- the merged descriptor
-
addIfAbsent
static boolean addIfAbsent(io.helidon.pico.tools.DefaultModuleInfoDescriptor.Builder builder, String target, Supplier<ModuleInfoItem> itemSupplier) Takes a builder, and if the target does not yet exist, will add the new module info item from the supplier.- Parameters:
builder- the fluent buildertarget- the target to check for existence foritemSupplier- the item to add which presumably has the same target as above- Returns:
- true if added
-
create
Loads and creates themodule-infodescriptor given its source file location.- Parameters:
path- the source path location for the module-info descriptor- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
create
Loads and creates themodule-infodescriptor given its source file location and preferred ordering scheme.- Parameters:
path- the source path location for the module-info descriptorordering- the ordering to apply- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
create
Loads and creates themodule-infodescriptor given its source input stream.- Parameters:
is- the source file input stream- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
create
Loads and creates themodule-infodescriptor given its input stream.- Parameters:
is- the source file locationordering- the ordering to apply- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
create
Loads and creates themodule-infodescriptor given its literal source.- Parameters:
moduleInfo- the source- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
create
Loads and creates themodule-infodescriptor given its literal source and preferred ordering scheme.- Parameters:
moduleInfo- the sourceordering- the ordering to apply- Returns:
- the module-info descriptor
- Throws:
ToolsException- if there is any exception encountered
-
save
Saves the descriptor source to the provided path.- Parameters:
path- the target path- Throws:
ToolsException- if there is any exception encountered
-
first
Retrieves the first item matching the target requested.- Parameters:
target- the target name to find- Returns:
- the item or empty if not found
-
firstUnqualifiedPackageExport
Returns the first export found in the module that is unqualified with any extratodeclaration.- Returns:
- the first package that is exported from this module, or empty if there are no exports appropriate
-
contents
Provides the content of the description appropriate to write out.- Returns:
- the contents (source code body) for this descriptor
-
contents
Provides the content of the description appropriate to write out.- Parameters:
wantAnnotation- flag determining whether the Generated annotation comment should be present- Returns:
- the contents (source code body) for this descriptor
-
usesExternalContract
Creates a new item declaring ausesexternal contract definition from this module descriptor.- Parameters:
externalContract- the external contract definition- Returns:
- the item created
-
usesExternalContract
Creates a new item declaring ausesexternal contract definition from this module descriptor.- Parameters:
externalContract- the external contract definition- Returns:
- the item created
-
usesExternalContract
Creates a new item declaring ausesexternal contract definition from this module descriptor.- Parameters:
externalContract- the external contract definition- Returns:
- the item created
-
providesContract
Creates a new item declaring it to provide some contract from this module definition, along with a'with'declaration.- Parameters:
contract- the contract definition being providedwith- the with part- Returns:
- the item created
-
requiresModuleName
Creates a new item declaring arequireson an external module usage from this module descriptor.- Parameters:
moduleName- the module name to require- Returns:
- the item created
-
requiresModuleName
static ModuleInfoItem requiresModuleName(String moduleName, boolean isTransitive, boolean isStatic, List<String> comments) Creates a new item declaring arequireson an external module usage from this module descriptor, that is extended to use additional item attributes.- Parameters:
moduleName- the module name to requireisTransitive- true if the requires declaration is transitiveisStatic- true if the requires declaration is staticcomments- any comments to ascribe to the item- Returns:
- the item created
-
exportsPackage
Creates a new itemexportson a package from this module descriptor.- Parameters:
typeName- the type name exported- Returns:
- the item created
-
exportsPackage
Creates a new itemexportson a package from this module descriptor.- Parameters:
pkg- the package name exported- Returns:
- the item created
-
exportsPackage
Creates a new itemexportson a package from this module descriptor, along with a'to'declaration.- Parameters:
contract- the contract definition being exportedto- the to part- Returns:
- the item created
-