Class ModuleSource


  • final class ModuleSource
    extends java.lang.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 Detail

      • moduleClassName

        private final java.lang.String moduleClassName
        The class name of module that this ModuleSource associated to.
    • Constructor Detail

      • ModuleSource

        ModuleSource​(java.lang.Class<?> moduleClass,
                     java.lang.StackTraceElement[] partialCallStack)
        Creates a new ModuleSource with a null parent.
        Parameters:
        moduleClass - the corresponding module
        partialCallStack - the chunk of call stack that starts from the parent module configure(Binder) call and ends just before the module configure(Binder) method invocation
      • ModuleSource

        private ModuleSource​(ModuleSource parent,
                             java.lang.Class<?> moduleClass,
                             java.lang.StackTraceElement[] partialCallStack)
        Creates a new ModuleSource Object.
        Parameters:
        parent - the parent module source
        moduleClass - the corresponding module
        partialCallStack - the chunk of call stack that starts from the parent module configure(Binder) call and ends just before the module configure(Binder) method invocation
    • Method Detail

      • getModuleClassName

        java.lang.String getModuleClassName()
        Returns the corresponding module class name.
        See Also:
        Class.getName()
      • getPartialCallStack

        java.lang.StackTraceElement[] getPartialCallStack()
        Returns the chunk of call stack that starts from the parent module configure(Binder) call and ends just before the module configure(Binder) method invocation. The return array is non-empty only if stack trace collection is on.
      • getPartialCallStackSize

        int getPartialCallStackSize()
        Returns the size of partial call stack if stack trace collection is on otherwise zero.
      • createChild

        ModuleSource createChild​(java.lang.Class<?> moduleClass,
                                 java.lang.StackTraceElement[] partialCallStack)
        Creates and returns a child ModuleSource corresponding to the module.
        Parameters:
        moduleClass - the corresponding module
        partialCallStack - the chunk of call stack that starts from the parent module configure(Binder) call and ends just before the module configure(Binder) method invocation
      • 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 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.
      • getStackTraceSize

        int getStackTraceSize()
        Returns the size of call stack that ends just before the module configure(Binder) method invocation (see getStackTrace()).
      • getStackTrace

        java.lang.StackTraceElement[] getStackTrace()
        Returns the full call stack that ends just before the module configure(Binder) method invocation. The return array is non-empty if stack trace collection on.