Class ModuleQualifiedExportsService

java.lang.Object
org.elasticsearch.jdk.ModuleQualifiedExportsService

public abstract class ModuleQualifiedExportsService extends Object
An object that provides a callback for qualified exports and opens. Because Elasticsearch sometimes constructs module layers dynamically (eg for plugins), qualified exports are silently dropped if a target module does not yet exist. Modules that have qualified exports to other dynamically created modules should implement this service so that when a qualified export module is loaded, the exporting or opening module can be informed and export or open dynamically to the newly loaded module.
  • Field Details

    • module

      protected final Module module
  • Constructor Details

    • ModuleQualifiedExportsService

      protected ModuleQualifiedExportsService()
    • ModuleQualifiedExportsService

      protected ModuleQualifiedExportsService(Module module)
  • Method Details

    • addExportsService

      public static void addExportsService(Map<String,List<ModuleQualifiedExportsService>> qualifiedExports, ModuleQualifiedExportsService exportsService, String moduleName)
      A utility method to add an export service to the given map of exports services. The map is inverted, keyed by the target module name to which an exports/opens applies.
      Parameters:
      qualifiedExports - A map of modules to which qualfied exports need to be applied
      exportsService - The exports service to add to the map
      moduleName - The name of the module that is doing the exporting
    • exposeQualifiedExportsAndOpens

      public static void exposeQualifiedExportsAndOpens(Module target, Map<String,List<ModuleQualifiedExportsService>> qualifiedExports)
      Adds qualified exports and opens declared in other upstream modules to the target module. This is required since qualified statements targeting yet-to-be-created modules, i.e. plugins, are silently dropped when the boot layer is created.
    • getBootServices

      public static Map<String,List<ModuleQualifiedExportsService>> getBootServices()
      Returns a mapping of ModuleQualifiedExportsServices that exist in the boot layer.
    • getTargets

      public Set<String> getTargets()
      Returns all qualified targets of the owning module.
    • addExportsAndOpens

      public void addExportsAndOpens(Module target)
      Add exports and opens for a target module.
      Parameters:
      target - A module whose name exists in getTargets()
    • addExports

      protected abstract void addExports(String pkg, Module target)
      Add a qualified export. This should always be implemented as follows: module.addExports(pkg, target);
    • addOpens

      protected abstract void addOpens(String pkg, Module target)
      Add a qualified open. This should always be implemented as follows: module.addOpens(pkg, target);