Class BindingSourceRestriction.PermitMapConstruction

  • Enclosing class:
    BindingSourceRestriction

    static final class BindingSourceRestriction.PermitMapConstruction
    extends java.lang.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 Detail

      • modulePermits

        final java.util.Map<ModuleSource,​com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>>> modulePermits
      • currentModulePermits

        com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>> currentModulePermits
      • modulePermitsStack

        final java.util.Deque<com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>>> modulePermitsStack
    • Constructor Detail

      • PermitMapConstruction

        PermitMapConstruction()
    • Method Detail

      • 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​(java.lang.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.
      • isElementSourceCleared

        static boolean isElementSourceCleared​(ElementSource elementSource)