Class ModuleSource

java.lang.Object
com.google.inject.spi.ModuleSource

final class ModuleSource extends Object
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 Details

    • moduleClassName

      private final String moduleClassName
      The class name of module that this ModuleSource associated to.
    • parent

      private final ModuleSource parent
      The parent module 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 Details

  • Method Details

    • getModuleClassName

      String getModuleClassName()
      Returns the corresponding module class name.
      See Also:
    • createChild

      ModuleSource createChild(Class<?> moduleClass)
      Creates and returns a child ModuleSource corresponding to the module.
      Parameters:
      moduleClass - the corresponding module
    • getParent

      ModuleSource getParent()
      Returns the parent module source.
    • getModuleClassNames

      List<String> getModuleClassNames()
      Returns the class names of modules in this module source. The first element (index 0) is filled by this object getModuleClassName(). The second element is filled by the parent's getModuleClassName() and so on.
    • size

      int size()
      Returns the size of ModuleSources chain (all parents) that ends at this object.
    • getPermitMap

      Returns the permit map created by the binder that installed this module.