Package com.google.inject.spi
Class ModuleSource
java.lang.Object
com.google.inject.spi.ModuleSource
Associated to a
module
, provides the module class name, the parent module source
, and the call stack that ends just before the module configure(Binder)
method invocation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
The class name of module that thisModuleSource
associated to.private final ModuleSource
The parentmodule source
.private final BindingSourceRestriction.PermitMap
Permit map created by the binder that installed this module. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ModuleSource
(ModuleSource parent, Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap) Creates a newModuleSource
Object.(package private)
ModuleSource
(Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap) Creates a newModuleSource
with a null parent. -
Method Summary
Modifier and TypeMethodDescription(package private) ModuleSource
createChild
(Class<?> moduleClass) Creates and returns a childModuleSource
corresponding to themodule
.(package private) String
Returns the corresponding module class name.Returns the class names of modules in this module source.(package private) ModuleSource
Returns the parent modulesource
.(package private) BindingSourceRestriction.PermitMap
Returns the permit map created by the binder that installed this module.(package private) int
size()
Returns the size ofModuleSources
chain (all parents) that ends at this object.
-
Field Details
-
moduleClassName
The class name of module that thisModuleSource
associated to. -
parent
The parentmodule source
. -
permitMap
Permit map created by the binder that installed this module.The permit map is a binder-scoped object, but it's saved here because these maps have to outlive the binders that created them in order to be used at injector creation, and there isn't a 'BinderSource' object.
-
-
Constructor Details
-
ModuleSource
ModuleSource(Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap) Creates a newModuleSource
with a null parent.- Parameters:
moduleClass
- the corresponding module
-
ModuleSource
private ModuleSource(@Nullable ModuleSource parent, Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap) Creates a newModuleSource
Object.- Parameters:
parent
- the parent modulesource
moduleClass
- the corresponding modulepartialCallStack
- the chunk of call stack that starts from the parent moduleconfigure(Binder)
call and ends just before the moduleconfigure(Binder)
method invocation
-
-
Method Details
-
getModuleClassName
String getModuleClassName()Returns the corresponding module class name.- See Also:
-
createChild
Creates and returns a childModuleSource
corresponding to themodule
.- Parameters:
moduleClass
- the corresponding module
-
getParent
ModuleSource getParent()Returns the parent modulesource
. -
getModuleClassNames
Returns the class names of modules in this module source. The first element (index 0) is filled by this objectgetModuleClassName()
. The second element is filled by the parent'sgetModuleClassName()
and so on. -
size
int size()Returns the size ofModuleSources
chain (all parents) that ends at this object. -
getPermitMap
BindingSourceRestriction.PermitMap getPermitMap()Returns the permit map created by the binder that installed this module.
-