Package com.google.inject.spi
Class BindingSourceRestriction.PermitMapConstruction
- java.lang.Object
-
- com.google.inject.spi.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'sModuleSource
to all theRestrictedBindingSource.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
BindingSourceRestriction.PermitMapConstruction.PermitMapImpl
-
Field Summary
Fields Modifier and Type Field Description (package private) com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>>
currentModulePermits
(package private) java.util.Map<ModuleSource,com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>>>
modulePermits
(package private) java.util.Deque<com.google.common.collect.ImmutableSet<java.lang.Class<? extends java.lang.annotation.Annotation>>>
modulePermitsStack
(package private) BindingSourceRestriction.PermitMapConstruction.PermitMapImpl
permitMap
-
Constructor Summary
Constructors Constructor Description PermitMapConstruction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
finish()
Finishes theBindingSourceRestriction.PermitMap
.(package private) BindingSourceRestriction.PermitMap
getPermitMap()
Returns a possibly unfinished map.(package private) static boolean
isElementSourceCleared(ElementSource elementSource)
(package private) void
popModule()
Called by the Binder when it exits a module's configure method.(package private) void
pushModule(java.lang.Class<?> module, ModuleSource moduleSource)
Called by the Binder prior to entering a module's configure method.(package private) 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.
-
-
-
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
-
permitMap
final BindingSourceRestriction.PermitMapConstruction.PermitMapImpl permitMap
-
-
Method Detail
-
getPermitMap
BindingSourceRestriction.PermitMap 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(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.
-
finish
void finish()
Finishes theBindingSourceRestriction.PermitMap
. Called by the Binder when all modules are installed.
-
isElementSourceCleared
static boolean isElementSourceCleared(ElementSource elementSource)
-
-