Package com.google.inject.spi
Class ModuleSource
- java.lang.Object
-
- com.google.inject.spi.ModuleSource
-
final class ModuleSource extends java.lang.ObjectAssociated to amodule, provides the module class name, the parent modulesource, and the call stack that ends just before the moduleconfigure(Binder)method invocation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringmoduleClassNameThe class name of module that thisModuleSourceassociated to.private ModuleSourceparentThe parentmodule source.private BindingSourceRestriction.PermitMappermitMapPermit map created by the binder that installed this module.
-
Constructor Summary
Constructors Modifier Constructor Description privateModuleSource(ModuleSource parent, java.lang.Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap)Creates a newModuleSourceObject.(package private)ModuleSource(java.lang.Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap)Creates a newModuleSourcewith a null parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ModuleSourcecreateChild(java.lang.Class<?> moduleClass)Creates and returns a childModuleSourcecorresponding to themodule.(package private) java.lang.StringgetModuleClassName()Returns the corresponding module class name.(package private) java.util.List<java.lang.String>getModuleClassNames()Returns the class names of modules in this module source.(package private) ModuleSourcegetParent()Returns the parent modulesource.(package private) BindingSourceRestriction.PermitMapgetPermitMap()Returns the permit map created by the binder that installed this module.(package private) intsize()Returns the size ofModuleSourceschain (all parents) that ends at this object.
-
-
-
Field Detail
-
moduleClassName
private final java.lang.String moduleClassName
The class name of module that thisModuleSourceassociated to.
-
parent
private final ModuleSource parent
The parentmodule source.
-
permitMap
private final BindingSourceRestriction.PermitMap 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 Detail
-
ModuleSource
ModuleSource(java.lang.Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap)Creates a newModuleSourcewith a null parent.- Parameters:
moduleClass- the corresponding module
-
ModuleSource
private ModuleSource(@Nullable ModuleSource parent, java.lang.Class<?> moduleClass, BindingSourceRestriction.PermitMap permitMap)Creates a newModuleSourceObject.- Parameters:
parent- the parent modulesourcemoduleClass- 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 Detail
-
getModuleClassName
java.lang.String getModuleClassName()
Returns the corresponding module class name.- See Also:
Class.getName()
-
createChild
ModuleSource createChild(java.lang.Class<?> moduleClass)
Creates and returns a childModuleSourcecorresponding to themodule.- Parameters:
moduleClass- the corresponding module
-
getParent
ModuleSource getParent()
Returns the parent modulesource.
-
getModuleClassNames
java.util.List<java.lang.String> 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 ofModuleSourceschain (all parents) that ends at this object.
-
getPermitMap
BindingSourceRestriction.PermitMap getPermitMap()
Returns the permit map created by the binder that installed this module.
-
-