Class ModuleInfo

java.lang.Object
org.gradlex.javamodule.moduleinfo.ModuleSpec
org.gradlex.javamodule.moduleinfo.ModuleInfo
All Implemented Interfaces:
Serializable

public class ModuleInfo extends ModuleSpec
Data class to hold the information that should be added as module-info.class to an existing Jar file.
See Also:
  • Method Details

    • closeModule

      public void closeModule()
      Should this be a 'module' instead of an 'open module'?
    • opens

      public void opens(String opens, String... to)
      Calling this method at least once automatically makes this a "closed" module: 'module' instead of 'open module'.
      Parameters:
      opens - corresponds to the directive in a 'module-info.java' file
      to - modules this package should be opened to.
    • exports

      public void exports(String exports, String... to)
      Parameters:
      exports - corresponds to the directive in a 'module-info.java' file
      to - modules this package should be exported to.
    • requires

      public void requires(String requires)
      Parameters:
      requires - corresponds to the directive in a 'module-info.java' file
    • requiresTransitive

      public void requiresTransitive(String requiresTransitive)
      Parameters:
      requiresTransitive - corresponds to the directive in a 'module-info.java' file
    • requiresStatic

      public void requiresStatic(String requiresStatic)
      Parameters:
      requiresStatic - corresponds to the directive in a 'module-info.java' file
    • requiresStaticTransitive

      public void requiresStaticTransitive(String requiresStaticTransitive)
      Parameters:
      requiresStaticTransitive - corresponds to the directive in a 'module-info.java' file
    • provides

      public void provides(String provides, String... with)
      Parameters:
      provides - corresponds to the directive in a 'module-info.java' file
      with - specifys the package(s) containing provided service classes
    • getProviders

      public Map<String,Set<String>> getProviders()
      Getter for the providers map (needed for the transformation logic)
      Returns:
    • uses

      public void uses(String uses)
      Parameters:
      uses - corresponds to the directive in a 'module-info.java' file
    • ignoreServiceProvider

      public void ignoreServiceProvider(String provider, String... implementations)
      Parameters:
      provider - do not transfer service provider to the 'module-info.class'
      implementations - the array of specific implementations to skip
    • getModuleVersion

      public @Nullable String getModuleVersion()
      Returns:
      configured version of the Module
    • exportAllPackages

      public void exportAllPackages()
      Automatically export all packages of the Jar. Can be used instead of individual 'exports()' statements.
    • exportAllPackagesExcept

      public void exportAllPackagesExcept(String... exceptions)
      Automatically export all packages of the Jar. Can be used instead of individual 'exports()' statements.
      Parameters:
      exceptions - A list of packages not to export
    • exportAllPackagesExcept

      public void exportAllPackagesExcept(List<String> exceptions)
      Automatically export all packages of the Jar. Can be used instead of individual 'exports()' statements.
      Parameters:
      exceptions - A list of packages not to export
    • requireAllDefinedDependencies

      public void requireAllDefinedDependencies()
      Automatically add 'requires' statements for all dependencies defined in the metadata of the component.
    • patchRealModule

      public void patchRealModule()
      Allow patching real (JARs with module-info.class) modules by overriding the existing module-info.class.
    • preserveExisting

      public void preserveExisting()
      Allow patching real (JARs with module-info.class) by extending the existing module-info.class.