Class BindingSourceRestriction.PermitMapConstruction

java.lang.Object
com.google.inject.spi.BindingSourceRestriction.PermitMapConstruction
Enclosing class:
BindingSourceRestriction

static final class BindingSourceRestriction.PermitMapConstruction extends Object
Builds the map from each module to all the permit annotations on its module stack.

Bindings refer to the module that created them via a ModuleSource. The map built here maps a module's ModuleSource to all the RestrictedBindingSource.Permit annotations found on the path from the root of the module hierarchy to it. This path contains all the modules that transitively install the module (including the module itself). This path is also known as the module stack.

The map is built by piggybacking on the depth-first traversal of the module hierarchy during Binder configuration.

  • Field Details

  • Constructor Details

    • PermitMapConstruction

      PermitMapConstruction()
  • Method Details

    • getPermitMap

      Returns a possibly unfinished map. The map should only be used after the construction is finished.
    • restoreCurrentModulePermits

      void restoreCurrentModulePermits(ModuleSource moduleSource)
      Sets the permits on the current module installation path to the permits on the given module source so that subsequently installed modules may inherit them. Used only for method scanning, so that modules installed by scanners inherit permits from the method's module.
    • pushModule

      void pushModule(Class<?> module, ModuleSource moduleSource)
      Called by the Binder prior to entering a module's configure method.
    • popModule

      void popModule()
      Called by the Binder when it exits a module's configure method.
    • finish

      void finish()
      Finishes the BindingSourceRestriction.PermitMap. Called by the Binder when all modules are installed.
    • isElementSourceCleared

      static boolean isElementSourceCleared(ElementSource elementSource)