Package com.google.inject.spi
Class BindingSourceRestriction.PermitMapConstruction
java.lang.Object
com.google.inject.spi.BindingSourceRestriction.PermitMapConstruction
- Enclosing class:
BindingSourceRestriction
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.google.common.collect.ImmutableSet
<Class<? extends Annotation>> (package private) final Map
<ModuleSource, com.google.common.collect.ImmutableSet<Class<? extends Annotation>>> (package private) final Deque
<com.google.common.collect.ImmutableSet<Class<? extends Annotation>>> (package private) final BindingSourceRestriction.PermitMapConstruction.PermitMapImpl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
finish()
Finishes theBindingSourceRestriction.PermitMap
.(package private) BindingSourceRestriction.PermitMap
Returns a possibly unfinished map.(package private) static boolean
isElementSourceCleared
(ElementSource elementSource) (package private) void
Called by the Binder when it exits a module's configure method.(package private) void
pushModule
(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 Details
-
modulePermits
final Map<ModuleSource,com.google.common.collect.ImmutableSet<Class<? extends Annotation>>> modulePermits -
currentModulePermits
com.google.common.collect.ImmutableSet<Class<? extends Annotation>> currentModulePermits -
modulePermitsStack
-
permitMap
-
-
Constructor Details
-
PermitMapConstruction
PermitMapConstruction()
-
-
Method Details
-
getPermitMap
BindingSourceRestriction.PermitMap getPermitMap()Returns a possibly unfinished map. The map should only be used after the construction is finished. -
restoreCurrentModulePermits
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
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
-